1
0
mirror of https://github.com/fumiama/NanoBot.git synced 2026-06-13 15:00:41 +08:00
This commit is contained in:
源文雨
2023-10-17 00:38:52 +09:00
parent 67836c78e3
commit edad23ff3b
2 changed files with 10 additions and 0 deletions

View File

@@ -82,6 +82,9 @@ func (ctx *Ctx) Send(replytosender bool, post *MessagePost) (*Message, error) {
MessageID: msg.ID,
}
}
if msg.SrcGuildID != "" { // dms
return ctx.Caller.PostMessageToUser(msg.GuildID, post)
}
return ctx.Caller.PostMessageToChannel(msg.ChannelID, post)
}
@@ -97,6 +100,9 @@ func (ctx *Ctx) SendPlainMessage(replytosender bool, printable ...any) (*Message
}
}
post.Content = fmt.Sprint(printable...)
if msg.SrcGuildID != "" { // dms
return ctx.Caller.PostMessageToUser(msg.GuildID, post)
}
return ctx.Caller.PostMessageToChannel(msg.ChannelID, post)
}
@@ -117,6 +123,9 @@ func (ctx *Ctx) SendImage(file string, replytosender bool, caption ...any) (*Mes
}
}
post.Content = fmt.Sprint(caption...)
if msg.SrcGuildID != "" { // dms
return ctx.Caller.PostMessageToUser(msg.GuildID, post)
}
return ctx.Caller.PostMessageToChannel(msg.ChannelID, post)
}

View File

@@ -45,6 +45,7 @@ func (m *Message) String() string {
sb.WriteByte('[')
sb.WriteString(m.SeqInChannel)
sb.WriteByte(']')
sb.WriteString(m.ID)
sb.WriteString(" ギルド: ")
sb.WriteString(m.GuildID)
if m.SrcGuildID != "" {