diff --git a/discord/invite.go b/discord/invite.go index c221333..d6fdb4c 100644 --- a/discord/invite.go +++ b/discord/invite.go @@ -1,22 +1,38 @@ package discord +// Invite represents a code that when used, adds a user to a guild or group +// DM channel. +// +// https://discord.com/developers/docs/resources/invite#invite-object type Invite struct { - Code string `json:"code"` - Channel Channel `json:"channel"` // partial - Guild *Guild `json:"guild,omitempty"` // partial - Inviter *User `json:"inviter,omitempty"` + // Code is the invite code (unique ID). + Code string `json:"code"` + // Guild is the partial guild this invite is for. + Guild *Guild `json:"guild,omitempty"` + // Channel is the partial channel this invite is for. + Channel Channel `json:"channel"` + // Inviter is the user who created the invite + Inviter *User `json:"inviter,omitempty"` - ApproxMembers uint `json:"approximate_members_count,omitempty"` - - Target *User `json:"target_user,omitempty"` // partial + // Target is the target user for this invite. + Target *User `json:"target_user,omitempty"` + // Target type is the type of user target for this invite. TargetType InviteUserType `json:"target_user_type,omitempty"` - // Only available if Target is - ApproxPresences uint `json:"approximate_presence_count,omitempty"` + // ApproximatePresences is the approximate count of online members (only + // present when Target is set). + ApproximatePresences uint `json:"approximate_presence_count,omitempty"` + // ApproximateMembers is the approximate count of total members + ApproximateMembers uint `json:"approximate_member_count,omitempty"` - InviteMetadata // only available when fetching ChannelInvites or GuildInvites + // InviteMetadata contains extra information about the invite. + // So far, this field is only available when fetching Channel- or + // GuildInvites. Additionally the Uses field is filled when getting the + // VanityURL of a guild. + InviteMetadata } +// https://discord.com/developers/docs/resources/invite#invite-object-target-user-types type InviteUserType uint8 const ( @@ -25,6 +41,8 @@ const ( ) // Extra information about an invite, will extend the invite object. +// +// https://discord.com/developers/docs/resources/invite#invite-metadata-object type InviteMetadata struct { // Number of times this invite has been used Uses int `json:"uses"`