فهرست منبع

Add User to Interaction

Carson Hoffman 3 سال پیش
والد
کامیت
ba10a00fbc
1فایلهای تغییر یافته به همراه14 افزوده شده و 3 حذف شده
  1. 14 3
      interactions.go

+ 14 - 3
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.