diff --git a/src/commands/CommandHandler.ts b/src/commands/CommandHandler.ts index 08a8412..bc052d8 100644 --- a/src/commands/CommandHandler.ts +++ b/src/commands/CommandHandler.ts @@ -25,7 +25,7 @@ export function handleCommand(roomId: string, event: any, mjolnir: Mjolnir) { const cmd = event['content']['body']; const parts = cmd.trim().split(' '); - if (parts.length === 1) { + if (parts.length === 1 || parts[1] === 'status') { return execStatusCommand(roomId, event, mjolnir); } else if (parts[1] === 'ban' && parts.length > 3) { return execBanCommand(roomId, event, mjolnir, parts); diff --git a/src/commands/StatusCommand.ts b/src/commands/StatusCommand.ts index 4590264..a470e20 100644 --- a/src/commands/StatusCommand.ts +++ b/src/commands/StatusCommand.ts @@ -15,6 +15,7 @@ limitations under the License. */ import { Mjolnir } from "../Mjolnir"; +import { RichReply } from "matrix-bot-sdk"; // !mjolnir export async function execStatusCommand(roomId: string, event: any, mjolnir: Mjolnir) { @@ -37,11 +38,7 @@ export async function execStatusCommand(roomId: string, event: any, mjolnir: Mjo } html += ""; - const message = { - msgtype: "m.notice", - body: text, - format: "org.matrix.custom.html", - formatted_body: html, - }; - return mjolnir.client.sendMessage(roomId, message); + const reply = RichReply.createFor(roomId, event, text, html); + reply["msgtype"] = "m.notice"; + return mjolnir.client.sendMessage(roomId, reply); }