Actually reply to status commands

This commit is contained in:
Travis Ralston 2019-09-27 16:05:55 -06:00
parent 02288a3885
commit 4d16ff3e51
2 changed files with 5 additions and 8 deletions

View File

@ -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);

View File

@ -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 += "</ul>";
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);
}