Compare commits
No commits in common. "1a349cb045ee6a034ad1e234cf35d85bda739feed57eb1dcbf0501f169cd8279" and "9cabbc8813a715049f68308cddc946511b51fa9b4221ee98ca249edcf66fa090" have entirely different histories.
1a349cb045
...
9cabbc8813
6 changed files with 7 additions and 17 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,5 +1,2 @@
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
store.json
|
|
||||||
auth.json
|
|
||||||
config.json
|
|
||||||
|
|
|
||||||
1
auth.json
Normal file
1
auth.json
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"secretKey":"XT0HBMKvfXV9zp8r1CFuIHU4XWLps6qkfabacrxdkNQ="}
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"baseUrl": "https://",
|
"baseUrl": "https://matrix.aslan2142.space",
|
||||||
"userId": "@",
|
"userId": "@aslobot:aslan2142.space",
|
||||||
"authPath": "auth.json",
|
"authPath": "auth.json",
|
||||||
"storePath": "store.json",
|
"storePath": "store.json",
|
||||||
"auth": {
|
"auth": {
|
||||||
"accessToken": "",
|
"accessToken": "mct_iW6Cif22H34s5yAHrmqfBQUsMrGaH2_0QWfYU",
|
||||||
"deviceId": ""
|
"deviceId": "PBz1Ig9c3p"
|
||||||
},
|
},
|
||||||
"app": {
|
"app": {
|
||||||
"triggerPrefix": "!",
|
"triggerPrefix": "!",
|
||||||
|
|
@ -2,7 +2,6 @@ import config from "./config.json" with { type: "json" };
|
||||||
|
|
||||||
import { MatrixClient, createClient, ClientEvent } from "matrix-js-sdk";
|
import { MatrixClient, createClient, ClientEvent } from "matrix-js-sdk";
|
||||||
import { registerModules } from "./modules/module.js";
|
import { registerModules } from "./modules/module.js";
|
||||||
import { load, save } from "./store/store.js";
|
|
||||||
|
|
||||||
let matrixClient: MatrixClient | undefined = undefined;
|
let matrixClient: MatrixClient | undefined = undefined;
|
||||||
|
|
||||||
|
|
@ -39,7 +38,4 @@ if (initCode > 0) {
|
||||||
process.exit(initCode);
|
process.exit(initCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
load();
|
|
||||||
setInterval(() => save(), 60000);
|
|
||||||
|
|
||||||
listen();
|
listen();
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ const onHelp = (_text: string, roomId: string) => {
|
||||||
<hr/>
|
<hr/>
|
||||||
<h3>Role: Moderator</h3>
|
<h3>Role: Moderator</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><b>!loaddata</b> - Load bot data</li>
|
<li><b>!load</b> - Load bot data</li>
|
||||||
<li><b>!savedata</b> - Save bot data</li>
|
<li><b>!save</b> - Save bot data</li>
|
||||||
</ul>
|
</ul>
|
||||||
<hr/>
|
<hr/>
|
||||||
<h3>Role: Admin</h3>
|
<h3>Role: Admin</h3>
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,11 @@ const load = () => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("loading data...");
|
|
||||||
|
|
||||||
const json = readFileSync(config.storePath).toString();
|
const json = readFileSync(config.storePath).toString();
|
||||||
state = JSON.parse(json) as IState;
|
state = JSON.parse(json) as IState;
|
||||||
};
|
};
|
||||||
|
|
||||||
const save = () => {
|
const save = () => {
|
||||||
console.log("saving data...");
|
|
||||||
|
|
||||||
const json = JSON.stringify(state);
|
const json = JSON.stringify(state);
|
||||||
writeFileSync(config.storePath, json);
|
writeFileSync(config.storePath, json);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue