From ca264d70ff420ed42631ee3ddacc8c9a43a1a107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?To=CF=80Senpai?= <15636011+TopiSenpai@users.noreply.github.com> Date: Sat, 26 Feb 2022 21:16:57 +0100 Subject: [PATCH] add interaction field to message struct (#1112) * add message interaction field and struct * Update message.go Co-authored-by: Fedor Lapshin * Update message.go Co-authored-by: Fedor Lapshin * Update message.go Co-authored-by: Fedor Lapshin * add notice when member is present * correct comment Co-authored-by: Fedor Lapshin --- message.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/message.go b/message.go index 265279e..eb2f496 100644 --- a/message.go +++ b/message.go @@ -135,6 +135,11 @@ type Message struct { // If the field exists but is null, the referenced message was deleted. ReferencedMessage *Message `json:"referenced_message"` + // Is sent when the message is a response to an Interaction, without an existing message. + // This means responses to message component interactions do not include this property, + // instead including a MessageReference, as components exist on preexisting messages. + Interaction *MessageInteraction `json:"interaction"` + // The flags of the message, which describe extra features of a message. // This is a combination of bit masks; the presence of a certain permission can // be checked by performing a bitwise AND between this int and the flag. @@ -523,3 +528,14 @@ func (m *Message) ContentWithMoreMentionsReplaced(s *Session) (content string, e }) return } + +// MessageInteraction contains information about the application command interaction which generated the message. +type MessageInteraction struct { + ID string `json:"id"` + Type InteractionType `json:"type"` + Name string `json:"name"` + User *User `json:"user"` + + // Member is only present when the interaction is from a guild. + Member *Member `json:"member"` +}