1
0
mirror of https://github.com/fumiama/NanoBot.git synced 2026-06-12 06:00:29 +08:00

fix message

This commit is contained in:
源文雨
2023-10-18 15:23:54 +09:00
parent a6a961da65
commit 4c6486219e

View File

@@ -78,8 +78,8 @@ func (ctx *Ctx) CheckSession() Rule {
// Send 发送消息到对方 // Send 发送消息到对方
func (ctx *Ctx) Send(replytosender bool, post *MessagePost) (reply *Message, err error) { func (ctx *Ctx) Send(replytosender bool, post *MessagePost) (reply *Message, err error) {
msg, ok := ctx.Value.(*Message) msg := ctx.Message
if ok && msg != nil { if msg != nil {
post.ReplyMessageID = msg.ID post.ReplyMessageID = msg.ID
if replytosender { if replytosender {
post.MessageReference = &MessageReference{ post.MessageReference = &MessageReference{
@@ -95,7 +95,7 @@ func (ctx *Ctx) Send(replytosender bool, post *MessagePost) (reply *Message, err
} else { } else {
reply, err = ctx.PostMessageToChannel(msg.ChannelID, post) reply, err = ctx.PostMessageToChannel(msg.ChannelID, post)
} }
if ok && msg != nil && reply != nil && reply.ID != "" { if msg != nil && reply != nil && reply.ID != "" {
logtriggeredmessages(msg.ID, reply.ID) logtriggeredmessages(msg.ID, reply.ID)
} }
return return