diff --git a/src/commands/CommandHandler.ts b/src/commands/CommandHandler.ts index bc052d87..8fe52927 100644 --- a/src/commands/CommandHandler.ts +++ b/src/commands/CommandHandler.ts @@ -18,6 +18,8 @@ import { Mjolnir } from "../Mjolnir"; import { execStatusCommand } from "./StatusCommand"; import { execBanCommand, execUnbanCommand } from "./UnbanBanCommand"; import { execDumpRulesCommand } from "./DumpRulesCommand"; +import { RichReply } from "matrix-bot-sdk"; +import * as htmlEscape from "escape-html"; export const COMMAND_PREFIX = "!mjolnir"; @@ -34,6 +36,18 @@ export function handleCommand(roomId: string, event: any, mjolnir: Mjolnir) { } else if (parts[1] === 'rules') { return execDumpRulesCommand(roomId, event, mjolnir); } else { - // TODO: Help menu + // Help menu + const menu = "" + + "!mjolnir - Print status information\n" + + "!mjolnir status - Print status information\n" + + "!mjolnir ban [reason] - Adds an entity to the ban list\n" + + "!mjolnir unban - Removes an entity from the ban list\n" + + "!mjolnir rules - Lists the rules currently in use by Mjolnir\n" + + "!mjolnir help - This menu\n"; + const html = `Mjolnir help:
${htmlEscape(menu)}
`; + const text = `Mjolnir help:\n${menu}`; + const reply = RichReply.createFor(roomId, event, text, html); + reply["msgtype"] = "m.notice"; + return mjolnir.client.sendMessage(roomId, reply); } }