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
|
||||
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://",
|
||||
"userId": "@",
|
||||
"baseUrl": "https://matrix.aslan2142.space",
|
||||
"userId": "@aslobot:aslan2142.space",
|
||||
"authPath": "auth.json",
|
||||
"storePath": "store.json",
|
||||
"auth": {
|
||||
"accessToken": "",
|
||||
"deviceId": ""
|
||||
"accessToken": "mct_iW6Cif22H34s5yAHrmqfBQUsMrGaH2_0QWfYU",
|
||||
"deviceId": "PBz1Ig9c3p"
|
||||
},
|
||||
"app": {
|
||||
"triggerPrefix": "!",
|
||||
|
|
@ -2,7 +2,6 @@ import config from "./config.json" with { type: "json" };
|
|||
|
||||
import { MatrixClient, createClient, ClientEvent } from "matrix-js-sdk";
|
||||
import { registerModules } from "./modules/module.js";
|
||||
import { load, save } from "./store/store.js";
|
||||
|
||||
let matrixClient: MatrixClient | undefined = undefined;
|
||||
|
||||
|
|
@ -39,7 +38,4 @@ if (initCode > 0) {
|
|||
process.exit(initCode);
|
||||
}
|
||||
|
||||
load();
|
||||
setInterval(() => save(), 60000);
|
||||
|
||||
listen();
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ const onHelp = (_text: string, roomId: string) => {
|
|||
<hr/>
|
||||
<h3>Role: Moderator</h3>
|
||||
<ul>
|
||||
<li><b>!loaddata</b> - Load bot data</li>
|
||||
<li><b>!savedata</b> - Save bot data</li>
|
||||
<li><b>!load</b> - Load bot data</li>
|
||||
<li><b>!save</b> - Save bot data</li>
|
||||
</ul>
|
||||
<hr/>
|
||||
<h3>Role: Admin</h3>
|
||||
|
|
|
|||
|
|
@ -13,15 +13,11 @@ const load = () => {
|
|||
return;
|
||||
}
|
||||
|
||||
console.log("loading data...");
|
||||
|
||||
const json = readFileSync(config.storePath).toString();
|
||||
state = JSON.parse(json) as IState;
|
||||
};
|
||||
|
||||
const save = () => {
|
||||
console.log("saving data...");
|
||||
|
||||
const json = JSON.stringify(state);
|
||||
writeFileSync(config.storePath, json);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue