From ba10a00fbcfa34b7615de0e13e51eb8875f70161 Mon Sep 17 00:00:00 2001 From: Carson Hoffman Date: Fri, 12 Mar 2021 09:45:35 -0500 Subject: [PATCH] Add User to Interaction --- interactions.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/interactions.go b/interactions.go index d4ccbe8..7f631da 100644 --- a/interactions.go +++ b/interactions.go @@ -73,9 +73,20 @@ type Interaction struct { Data ApplicationCommandInteractionData `json:"data"` GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` - Member *Member `json:"member"` - Token string `json:"token"` - Version int `json:"version"` + + // The member who invoked this interaction. + // NOTE: this field is only filled when the slash command was invoked in a guild; + // if it was invoked in a DM, the `User` field will be filled instead. + // Make sure to check for `nil` before using this field. + Member *Member `json:"member"` + // The user who invoked this interaction. + // NOTE: this field is only filled when the slash command was invoked in a DM; + // if it was invoked in a guild, the `Member` field will be filled instead. + // Make sure to check for `nil` before using this field. + User *User `json:"user"` + + Token string `json:"token"` + Version int `json:"version"` } // ApplicationCommandInteractionData contains data received in an interaction event.