Discord: fix #83

This commit is contained in:
mavolin 2020-05-17 17:20:37 +02:00 committed by diamondburned
parent 1c53befad4
commit 805df29c2e
1 changed files with 28 additions and 10 deletions

View File

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