1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-27 17:23:00 +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"` Flags *discord.MessageFlags `json:"flags,omitempty"`
} }
// Edit a previously sent message. The fields Content, Embed, // EditMessage edits a previously sent message. For more documentation, erfer to
// AllowedMentions and Flags can be edited by the original message author. // EditMessageComplex.
// Other users can only edit flags and only if they have the MANAGE_MESSAGES func (c *Client) EditMessage(
// permission in the corresponding channel. When specifying flags, ensure to channelID, messageID discord.Snowflake, content string,
// include all previously set flags/bits in addition to ones that you are embed *discord.Embed, suppressEmbeds bool) (*discord.Message, error) {
// modifying. Only flags documented in EditMessageData may be modified by users
// (unsupported flag changes are currently ignored without 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. // Fires a Message Update Gateway event.
func (c *Client) EditMessage( func (c *Client) EditMessageComplex(
channelID, messageID discord.Snowflake, data EditMessageData) (*discord.Message, error) { channelID, messageID discord.Snowflake, data EditMessageData) (*discord.Message, error) {
var msg *discord.Message var msg *discord.Message