1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-30 18:53:30 +00:00

API: Reversed EditMessage API for backwards compatibility and consistency

This commit is contained in:
diamondburned (Forefront) 2020-05-12 16:51:35 -07:00
parent 2548b92f1e
commit 9f1f7547b9

View file

@ -161,16 +161,34 @@ type EditMessageData struct {
Flags *discord.MessageFlags `json:"flags,omitempty"`
}
// Edit a previously sent message. The fields Content, Embed,
// AllowedMentions and Flags can be edited by the original message author.
// Other users can only edit flags and only if they have the MANAGE_MESSAGES
// permission in the corresponding channel. When specifying flags, ensure to
// include all previously set flags/bits in addition to ones that you are
// modifying. Only flags documented in EditMessageData may be modified by users
// (unsupported flag changes are currently ignored without error).
// EditMessage edits a previously sent message. For more documentation, erfer to
// EditMessageComplex.
func (c *Client) EditMessage(
channelID, messageID discord.Snowflake, content string,
embed *discord.Embed, suppressEmbeds bool) (*discord.Message, error) {
var data = EditMessageData{
Content: option.NewNullableString(content),
Embed: embed,
}
if suppressEmbeds {
data.Flags = &discord.SuppressEmbeds
}
return c.EditMessageComplex(channelID, messageID, data)
}
// EditMessageComplex edits a previously sent message. The fields Content,
// Embed, AllowedMentions and Flags can be edited by the original message
// author. Other users can only edit flags and only if they have the
// MANAGE_MESSAGES permission in the corresponding channel. When specifying
// flags, ensure to include all previously set flags/bits in addition to ones
// that you are modifying. Only flags documented in EditMessageData may be
// modified by users (unsupported flag changes are currently ignored without
// error).
//
// Fires a Message Update Gateway event.
func (c *Client) EditMessage(
func (c *Client) EditMessageComplex(
channelID, messageID discord.Snowflake, data EditMessageData) (*discord.Message, error) {
var msg *discord.Message