allow only text message events for commands
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"maunium.net/go/mautrix/event"
|
||||||
"maunium.net/go/mautrix/format"
|
"maunium.net/go/mautrix/format"
|
||||||
"maunium.net/go/mautrix/id"
|
"maunium.net/go/mautrix/id"
|
||||||
|
|
||||||
@@ -284,6 +285,10 @@ func (b *Bot) handle(ctx context.Context) {
|
|||||||
b.Error(ctx, evt.RoomID, "cannot read message")
|
b.Error(ctx, evt.RoomID, "cannot read message")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// ignore any type apart from text (e.g. reactions, redactions, notices, etc)
|
||||||
|
if content.MsgType != event.MsgText {
|
||||||
|
return
|
||||||
|
}
|
||||||
message := strings.TrimSpace(content.Body)
|
message := strings.TrimSpace(content.Body)
|
||||||
commandSlice := b.parseCommand(message, true)
|
commandSlice := b.parseCommand(message, true)
|
||||||
if commandSlice == nil {
|
if commandSlice == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user