From e02da56ad0c5935aa4500e6afde6a785e9fe2438 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 24 Oct 2020 16:51:23 +0300 Subject: [PATCH] Fix creating groups in unencrypted rooms Fixes #209 Closes #233 --- commands.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands.go b/commands.go index 5d4b72c..4bb8293 100644 --- a/commands.go +++ b/commands.go @@ -17,6 +17,7 @@ package main import ( + "errors" "fmt" "math" "sort" @@ -280,7 +281,7 @@ func (handler *CommandHandler) CommandCreate(ce *CommandEvent) { var roomNameEvent event.RoomNameEventContent err = ce.Bot.StateEvent(ce.RoomID, event.StateRoomName, "", &roomNameEvent) - if err != nil { + if err != nil && !errors.Is(err, mautrix.MNotFound) { ce.Reply("Failed to get room name") return } else if len(roomNameEvent.Name) == 0 { @@ -290,7 +291,7 @@ func (handler *CommandHandler) CommandCreate(ce *CommandEvent) { var encryptionEvent event.EncryptionEventContent err = ce.Bot.StateEvent(ce.RoomID, event.StateEncryption, "", &encryptionEvent) - if err != nil { + if err != nil && !errors.Is(err, mautrix.MNotFound) { ce.Reply("Failed to get room encryption status") return }