add interaction field to message struct (#1112)

* add message interaction field and struct

* Update message.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* Update message.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* Update message.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* add notice when member is present

* correct comment

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
This commit is contained in:
ToπSenpai 2022-02-26 21:16:57 +01:00 committed by GitHub
parent a4d694738f
commit ca264d70ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"`
}