diff --git a/context.go b/context.go index fa62851..cf6e90a 100644 --- a/context.go +++ b/context.go @@ -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) } diff --git a/openapi_message.go b/openapi_message.go index f9481ce..30103dc 100644 --- a/openapi_message.go +++ b/openapi_message.go @@ -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 != "" {