1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-06-08 02:11:12 +00:00

API: Added SendReply methods (#187)

* API: Added SendReply methods

* Grammar edit

* referenceID & adheres to 100 column limit
This commit is contained in:
Scott 2021-02-14 20:29:41 +00:00 committed by GitHub
parent d13aa00a57
commit abeaef8122
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -191,7 +191,7 @@ func (c *Client) Message(channelID discord.ChannelID, messageID discord.MessageI
EndpointChannels+channelID.String()+"/messages/"+messageID.String())
}
// SendText posts a only-text message to a guild text or DM channel.
// SendText posts a text-only message to a guild text or DM channel.
//
// If operating on a guild channel, this endpoint requires the SEND_MESSAGES
// permission to be present on the current user.
@ -203,6 +203,23 @@ func (c *Client) SendText(channelID discord.ChannelID, content string) (*discord
})
}
// SendTextReply posts a text-only reply to a message ID in a guild text or DM channel
//
// If operating on a guild channel, this endpoint requires the SEND_MESSAGES
// permission to be present on the current user.
//
// Fires a Message Create Gateway event.
func (c *Client) SendTextReply(
channelID discord.ChannelID,
content string,
referenceID discord.MessageID) (*discord.Message, error) {
return c.SendMessageComplex(channelID, SendMessageData{
Content: content,
Reference: &discord.MessageReference{MessageID: referenceID},
})
}
// SendEmbed posts an Embed to a guild text or DM channel.
//
// If operating on a guild channel, this endpoint requires the SEND_MESSAGES
@ -217,6 +234,23 @@ func (c *Client) SendEmbed(
})
}
// SendEmbedReply posts an Embed reply to a message ID in a guild text or DM channel.
//
// If operating on a guild channel, this endpoint requires the SEND_MESSAGES
// permission to be present on the current user.
//
// Fires a Message Create Gateway event.
func (c *Client) SendEmbedReply(
channelID discord.ChannelID,
e discord.Embed,
referenceID discord.MessageID) (*discord.Message, error) {
return c.SendMessageComplex(channelID, SendMessageData{
Embed: &e,
Reference: &discord.MessageReference{MessageID: referenceID},
})
}
// SendMessage posts a message to a guild text or DM channel.
//
// If operating on a guild channel, this endpoint requires the SEND_MESSAGES
@ -232,6 +266,25 @@ func (c *Client) SendMessage(
})
}
// SendMessageReply posts a reply to a message ID in a guild text or DM channel.
//
// If operating on a guild channel, this endpoint requires the SEND_MESSAGES
// permission to be present on the current user.
//
// Fires a Message Create Gateway event.
func (c *Client) SendMessageReply(
channelID discord.ChannelID,
content string,
embed *discord.Embed,
referenceID discord.MessageID) (*discord.Message, error) {
return c.SendMessageComplex(channelID, SendMessageData{
Content: content,
Embed: embed,
Reference: &discord.MessageReference{MessageID: referenceID},
})
}
// https://discord.com/developers/docs/resources/channel#edit-message-json-params
type EditMessageData struct {
// Content is the new message contents (up to 2000 characters).