diff --git a/src/bot/index.ts b/src/bot/index.ts index 1168e8f8..44e97ce6 100644 --- a/src/bot/index.ts +++ b/src/bot/index.ts @@ -7,6 +7,7 @@ import { logger } from "#src/logger"; import { getNetworkData } from "#src/papi/index"; import { isAccountPrivileged } from "#src/utils"; import * as mSDK from "matrix-js-sdk"; +import { TimelineEvents } from "matrix-js-sdk"; import { AccountId } from "polkadot-api"; const dripRequestHandler = getDripRequestHandlerInstance(polkadotActions); @@ -38,20 +39,22 @@ const bot = mSDK.createClient({ }); const sendMessage = (roomId: string, msg: string, formattedMsg?: string) => { - const msgObject: mSDK.IContent = { body: msg, msgtype: "m.text" }; + const msgObject: TimelineEvents[mSDK.EventType.RoomMessage] = { body: msg, msgtype: mSDK.MsgType.Text }; if (formattedMsg !== undefined) { msgObject.format = "org.matrix.custom.html"; msgObject.formatted_body = formattedMsg; } - bot.sendEvent(roomId, null, "m.room.message", msgObject, "").catch((e) => logger.error(e)); + bot.sendEvent(roomId, null, mSDK.EventType.RoomMessage, msgObject, "").catch((e) => logger.error(e)); }; const sendReaction = (roomId: string, eventId: string, emoji: string) => { - const msgObject: mSDK.IContent = { "m.relates_to": { event_id: eventId, key: emoji, rel_type: "m.annotation" } }; + const msgObject: TimelineEvents[mSDK.EventType.Reaction] = { + "m.relates_to": { event_id: eventId, key: emoji, rel_type: mSDK.RelationType.Annotation }, + }; - bot.sendEvent(roomId, null, "m.reaction", msgObject, "").catch((e) => logger.error(e)); + bot.sendEvent(roomId, null, mSDK.EventType.Reaction, msgObject, "").catch((e) => logger.error(e)); }; const printHelpMessage = (roomId: string, message = "") =>