From 72136d5aefc09ad8d8dcd5acb8740ca19552bdff Mon Sep 17 00:00:00 2001 From: mavolin <48887425+mavolin@users.noreply.github.com> Date: Tue, 12 May 2020 05:21:48 +0200 Subject: [PATCH] API: implement #49 --- api/message.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/api/message.go b/api/message.go index 64884c7..8870c41 100644 --- a/api/message.go +++ b/api/message.go @@ -106,6 +106,32 @@ func (c *Client) Message(channelID, messageID discord.Snowflake) (*discord.Messa EndpointChannels+channelID.String()+"/messages/"+messageID.String()) } +// SendText posts a only-text 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. +// +// Fires a Message Create Gateway event. +func (c *Client) SendText(channelID discord.Snowflake, content string) (*discord.Message, error) { + return c.SendMessageComplex(channelID, SendMessageData{ + Content: content, + }) +} + +// SendEmbed posts an Embed 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. +// +// Fires a Message Create Gateway event. +func (c *Client) SendEmbed( + channelID discord.Snowflake, e discord.Embed) (*discord.Message, error) { + + return c.SendMessageComplex(channelID, SendMessageData{ + Embed: &e, + }) +} + // SendMessage posts a message to a guild text or DM channel. // // If operating on a guild channel, this endpoint requires the SEND_MESSAGES