github.com/diamondburned/arikawa/v2@v2.1.0/discord/invite.go (about)

     1  package discord
     2  
     3  // Invite represents a code that when used, adds a user to a guild or group
     4  // DM channel.
     5  //
     6  // https://discord.com/developers/docs/resources/invite#invite-object
     7  type Invite struct {
     8  	// Code is the invite code (unique ID).
     9  	Code string `json:"code"`
    10  	// Guild is the partial guild this invite is for.
    11  	Guild *Guild `json:"guild,omitempty"`
    12  	// Channel is the partial channel this invite is for.
    13  	Channel Channel `json:"channel"`
    14  	// Inviter is the user who created the invite
    15  	Inviter *User `json:"inviter,omitempty"`
    16  
    17  	// Target is the target user for this invite.
    18  	Target *User `json:"target_user,omitempty"`
    19  	// Target type is the type of user target for this invite.
    20  	TargetType InviteUserType `json:"target_user_type,omitempty"`
    21  
    22  	// ApproximatePresences is the approximate count of online members (only
    23  	// present when Target is set).
    24  	ApproximatePresences uint `json:"approximate_presence_count,omitempty"`
    25  	// ApproximateMembers is the approximate count of total members
    26  	ApproximateMembers uint `json:"approximate_member_count,omitempty"`
    27  
    28  	// InviteMetadata contains extra information about the invite.
    29  	// So far, this field is only available when fetching Channel- or
    30  	// GuildInvites. Additionally the Uses field is filled when getting the
    31  	// VanityURL of a guild.
    32  	InviteMetadata
    33  }
    34  
    35  // https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
    36  type InviteUserType uint8
    37  
    38  const (
    39  	InviteNormalUser InviteUserType = iota
    40  	InviteUserStream
    41  )
    42  
    43  // Extra information about an invite, will extend the invite object.
    44  //
    45  // https://discord.com/developers/docs/resources/invite#invite-metadata-object
    46  type InviteMetadata struct {
    47  	// Number of times this invite has been used
    48  	Uses int `json:"uses"`
    49  	// Max number of times this invite can be used
    50  	MaxUses int `json:"max_uses"`
    51  	// Duration (in seconds) after which the invite expires
    52  	MaxAge Seconds `json:"max_age"`
    53  	// Whether this invite only grants temporary membership
    54  	Temporary bool `json:"temporary"`
    55  	// When this invite was created
    56  	CreatedAt Timestamp `json:"created_at"`
    57  }