eh
This commit is contained in:
parent
e39dc85ddc
commit
f0b9e7b1ba
4
index.js
4
index.js
|
@ -2,6 +2,7 @@ import config from './config.json' assert {type: "json"};
|
||||||
import { MatrixClient, SimpleFsStorageProvider, AutojoinRoomsMixin } from "matrix-bot-sdk";
|
import { MatrixClient, SimpleFsStorageProvider, AutojoinRoomsMixin } from "matrix-bot-sdk";
|
||||||
|
|
||||||
const storage = new SimpleFsStorageProvider("storage.json");
|
const storage = new SimpleFsStorageProvider("storage.json");
|
||||||
|
client.addPreprocessor(new RichRepliesPreprocessor(false));
|
||||||
const client = new MatrixClient(config.homeserver, config.token, storage);
|
const client = new MatrixClient(config.homeserver, config.token, storage);
|
||||||
|
|
||||||
AutojoinRoomsMixin.setupOnClient(client);
|
AutojoinRoomsMixin.setupOnClient(client);
|
||||||
|
@ -11,8 +12,9 @@ client.start().then(() => console.log(`Client has started!`));
|
||||||
client.on("room.message", (roomId, event) => {
|
client.on("room.message", (roomId, event) => {
|
||||||
// ? check if the message's text is not empty and isn't sent by the bot itself
|
// ? check if the message's text is not empty and isn't sent by the bot itself
|
||||||
if (! event["content"] || event["sender"] === config.user) return;
|
if (! event["content"] || event["sender"] === config.user) return;
|
||||||
|
const message = event["content"]["body"].toLowerCase();
|
||||||
// ? if message starts with the bot's <prefix + command> then execute the command
|
// ? if message starts with the bot's <prefix + command> then execute the command
|
||||||
if (event["content"]["body"].toLowerCase().startsWith(config.prefix + "COMMAND")){
|
if (message.startsWith(config.prefix + "COMMAND")){
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO: START CODE HERE
|
// TODO: START CODE HERE
|
||||||
|
|
Loading…
Reference in a new issue