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