Initial commit
This commit is contained in:
commit
45cd7a1270
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
go.old
|
||||
node_modules
|
7
config/bot.json
Normal file
7
config/bot.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"syncToken": null,
|
||||
"filter": null,
|
||||
"appserviceUsers": {},
|
||||
"appserviceTransactions": {},
|
||||
"kvStore": {}
|
||||
}
|
26
index.js
Normal file
26
index.js
Normal file
@ -0,0 +1,26 @@
|
||||
const sdk = require("matrix-bot-sdk");
|
||||
const MatrixClient = sdk.MatrixClient;
|
||||
const SimpleFsStorageProvider = sdk.SimpleFsStorageProvider;
|
||||
const AutojoinRoomsMixin = sdk.AutojoinRoomsMixin;
|
||||
|
||||
const homeserverUrl = "";
|
||||
const accessToken = "";
|
||||
|
||||
const storage = new SimpleFsStorageProvider("config/bot.json");
|
||||
|
||||
const client = new MatrixClient(homeserverUrl, accessToken, storage);
|
||||
AutojoinRoomsMixin.setupOnClient(client);
|
||||
|
||||
client.start().then(() => console.log("Client started!"));
|
||||
|
||||
client.on("room.message", (roomId, event) => {
|
||||
if (! event["content"]) return;
|
||||
const sender = event["sender"];
|
||||
const body = event["content"]["body"];
|
||||
console.log(`${roomId}: ${sender} says '${body}`);
|
||||
});
|
||||
|
||||
client.sendMessage(roomId, {
|
||||
"msgtype": "m.text",
|
||||
"body": "This is message text.",
|
||||
});
|
1733
package-lock.json
generated
Normal file
1733
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
package.json
Normal file
23
package.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "matrixtiktok",
|
||||
"version": "1.0.0",
|
||||
"description": "A bot to convert TikTok URLs into plain video format",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.kizaing.ca/kizaing/MatrixTikTok"
|
||||
},
|
||||
"keywords": [
|
||||
"matrix",
|
||||
"tiktok"
|
||||
],
|
||||
"author": "Kizaing",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"matrix-bot-sdk": "^0.6.3",
|
||||
"typescript": "^4.9.5"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user