From 174930fc9026f1bcaf57453145e59ebaed8bb7bb Mon Sep 17 00:00:00 2001 From: Aine Date: Sun, 8 Jan 2023 00:58:14 +0200 Subject: [PATCH] allow only text message events for commands --- bot/command.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bot/command.go b/bot/command.go index 4a5ce24..8104b68 100644 --- a/bot/command.go +++ b/bot/command.go @@ -6,6 +6,7 @@ import ( "strings" "time" + "maunium.net/go/mautrix/event" "maunium.net/go/mautrix/format" "maunium.net/go/mautrix/id" @@ -284,6 +285,10 @@ func (b *Bot) handle(ctx context.Context) { b.Error(ctx, evt.RoomID, "cannot read message") return } + // ignore any type apart from text (e.g. reactions, redactions, notices, etc) + if content.MsgType != event.MsgText { + return + } message := strings.TrimSpace(content.Body) commandSlice := b.parseCommand(message, true) if commandSlice == nil {