Fix replies from the management room

This was accidentally broken when implementing e2be.
This commit is contained in:
Gary Kramlich
2022-04-27 13:16:11 -05:00
parent c5f58afe71
commit d788565d2b

View File

@@ -3,7 +3,6 @@ package bridge
import (
"context"
"fmt"
"time"
"github.com/alecthomas/kong"
@@ -34,17 +33,11 @@ func (g *globals) reply(msg string) {
content.MsgType = event.MsgNotice
intent := g.bot
if g.portal == nil {
g.handler.log.Errorfln("we don't have a portal for this command")
return
}
if g.portal.IsPrivateChat() {
if g.portal != nil && g.portal.IsPrivateChat() {
intent = g.portal.MainIntent()
}
_, err := g.portal.sendMatrixMessage(intent, event.EventMessage, &content, nil, time.Now().UTC().UnixMilli())
_, err := intent.SendMessageEvent(g.roomID, event.EventMessage, content)
if err != nil {
g.handler.log.Warnfln("Failed to reply to command from %q: %v", g.user.MXID, err)
}