Add support for sending message reply
This commit is contained in:
parent
fb996efa76
commit
1b13267ba4
2 changed files with 21 additions and 0 deletions
10
message.go
10
message.go
|
@ -150,6 +150,7 @@ type MessageSend struct {
|
||||||
TTS bool `json:"tts"`
|
TTS bool `json:"tts"`
|
||||||
Files []*File `json:"-"`
|
Files []*File `json:"-"`
|
||||||
AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"`
|
AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"`
|
||||||
|
Reference *MessageReference `json:"message_reference,omitempty"`
|
||||||
|
|
||||||
// TODO: Remove this when compatibility is not required.
|
// TODO: Remove this when compatibility is not required.
|
||||||
File *File `json:"-"`
|
File *File `json:"-"`
|
||||||
|
@ -371,6 +372,15 @@ type MessageReference struct {
|
||||||
GuildID string `json:"guild_id"`
|
GuildID string `json:"guild_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reference returns MessageReference of given message
|
||||||
|
func (m *Message) Reference() *MessageReference {
|
||||||
|
return &MessageReference{
|
||||||
|
GuildID: m.GuildID,
|
||||||
|
ChannelID: m.ChannelID,
|
||||||
|
MessageID: m.ID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ContentWithMentionsReplaced will replace all @<id> mentions with the
|
// ContentWithMentionsReplaced will replace all @<id> mentions with the
|
||||||
// username of the mention.
|
// username of the mention.
|
||||||
func (m *Message) ContentWithMentionsReplaced() (content string) {
|
func (m *Message) ContentWithMentionsReplaced() (content string) {
|
||||||
|
|
11
restapi.go
11
restapi.go
|
@ -1629,6 +1629,17 @@ func (s *Session) ChannelMessageSendEmbed(channelID string, embed *MessageEmbed)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ChannelMessageSendReply sends a message to the given channel with reference data.
|
||||||
|
// channelID : The ID of a Channel.
|
||||||
|
// content : The message to send.
|
||||||
|
// reference : The message reference to send.
|
||||||
|
func (s *Session) ChannelMessageSendReply(channelID string, content string, reference *MessageReference) (*Message, error) {
|
||||||
|
return s.ChannelMessageSendComplex(channelID, &MessageSend{
|
||||||
|
Content: content,
|
||||||
|
Reference: reference,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// ChannelMessageEdit edits an existing message, replacing it entirely with
|
// ChannelMessageEdit edits an existing message, replacing it entirely with
|
||||||
// the given content.
|
// the given content.
|
||||||
// channelID : The ID of a Channel
|
// channelID : The ID of a Channel
|
||||||
|
|
Loading…
Reference in a new issue