import config from './config.json' assert {type: "json"}; import { MatrixClient, SimpleFsStorageProvider, AutojoinRoomsMixin, RichRepliesPreprocessor } from "matrix-bot-sdk"; const storage = new SimpleFsStorageProvider("storage.json"); const client = new MatrixClient(config.homeserver, config.token, storage); AutojoinRoomsMixin.setupOnClient(client); client.addPreprocessor(new RichRepliesPreprocessor(false)); client.start().then(() => console.log(`Client has started!`)); // ? event listener client.on("room.message", (roomId, event) => { // ? 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; const message = event["content"]["body"].toLowerCase(); // ? if message starts with the bot's then execute the command if (message.startsWith(config.prefix + "COMMAND")){ // // TODO: START CODE HERE // } })