From 7e9c07efa5cd85a2191c5b1e1aff83ac91897669 Mon Sep 17 00:00:00 2001 From: Andrey Dudin Date: Sun, 17 Apr 2022 15:56:37 +0300 Subject: [PATCH 1/2] Add ability to reply with embeds --- restapi.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/restapi.go b/restapi.go index a89063152..b6da7600c 100644 --- a/restapi.go +++ b/restapi.go @@ -1722,6 +1722,28 @@ func (s *Session) ChannelMessageSendReply(channelID string, content string, refe }) } +// ChannelMessageSendEmedReply 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 From cd53ae69e72765e543b8b1588ac568795d8b901e Mon Sep 17 00:00:00 2001 From: Andrey Dudin Date: Sat, 7 May 2022 17:49:07 +0300 Subject: [PATCH 2/2] Fix typo in method comment --- restapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/restapi.go b/restapi.go index b6da7600c..8c52cfbfc 100644 --- a/restapi.go +++ b/restapi.go @@ -1722,7 +1722,7 @@ func (s *Session) ChannelMessageSendReply(channelID string, content string, refe }) } -// ChannelMessageSendEmedReply sends a message to the given channel with reference data and embedded data. +// 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.