From e45536276050ae548cdaa84a73dbdbc4645f7938 Mon Sep 17 00:00:00 2001 From: Andrey Dudin Date: Sat, 14 May 2022 22:56:30 +0300 Subject: [PATCH] Add ability to reply with embeds (#1160) * Add ability to reply with embeds * Fix typo in method comment --- restapi.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/restapi.go b/restapi.go index 1eee79c..8c700be 100644 --- a/restapi.go +++ b/restapi.go @@ -1729,6 +1729,28 @@ func (s *Session) ChannelMessageSendReply(channelID string, content string, refe }) } +// ChannelMessageSendEmbedReply sends a message to the given channel with reference data and embedded data. +// channelID : The ID of a Channel. +// embed : The embed data to send. +// reference : The message reference to send. +func (s *Session) ChannelMessageSendEmbedReply(channelID string, embed *MessageEmbed, reference *MessageReference) (*Message, error) { + return s.ChannelMessageSendEmbedsReply(channelID, []*MessageEmbed{embed}, reference) +} + +// ChannelMessageSendEmbedsReply sends a message to the given channel with reference data and multiple embedded data. +// channelID : The ID of a Channel. +// embeds : The embeds data to send. +// reference : The message reference to send. +func (s *Session) ChannelMessageSendEmbedsReply(channelID string, embeds []*MessageEmbed, reference *MessageReference) (*Message, error) { + if reference == nil { + return nil, fmt.Errorf("reply attempted with nil message reference") + } + return s.ChannelMessageSendComplex(channelID, &MessageSend{ + Embeds: embeds, + Reference: reference, + }) +} + // ChannelMessageEdit edits an existing message, replacing it entirely with // the given content. // channelID : The ID of a Channel