Help us shape the future of Go! Take the 2026 Go Developer Survey

resource

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2018 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

resource ...

Index

Constants

View Source
const (
	AuditLogEvtGuildUpdate      = 1
	AuditLogEvtChannelCreate    = 10
	AuditLogEvtChannelUpdate    = 11
	AuditLogEvtChannelDelete    = 12
	AuditLogEvtOverwriteCreate  = 13
	AuditLogEvtOverwriteUpdate  = 14
	AuditLogEvtOverwriteDelete  = 15
	AuditLogEvtMemberKick       = 20
	AuditLogEvtMemberPrune      = 21
	AuditLogEvtMemberBanAdd     = 22
	AuditLogEvtMemberBanRemove  = 23
	AuditLogEvtMemberUpdate     = 24
	AuditLogEvtMemberRoleUpdate = 25
	AuditLogEvtRoleCreate       = 30
	AuditLogEvtRoleUpdate       = 31
	AuditLogEvtRoleDelete       = 32
	AuditLogEvtInviteCreate     = 40
	AuditLogEvtInviteUpdate     = 41
	AuditLogEvtInviteDelete     = 42
	AuditLogEvtWebhookCreate    = 50
	AuditLogEvtWebhookUpdate    = 51
	AuditLogEvtWebhookDelete    = 52
	AuditLogEvtEmojiCreate      = 60
	AuditLogEvtEmojiUpdate      = 61
	AuditLogEvtEmojiDelete      = 62
	AuditLogEvtMessageDelete    = 72
)
View Source
const (
	// key name,								          identifier                       changed, type,   description
	AuditLogChangeKeyName                        = "name"                          // guild	string	name changed
	AuditLogChangeKeyIconHash                    = "icon_hash"                     // guild	string	icon changed
	AuditLogChangeKeySplashHash                  = "splash_hash"                   // guild	string	invite splash page artwork changed
	AuditLogChangeKeyOwnerID                     = "owner_id"                      // guild	snowflake	owner changed
	AuditLogChangeKeyRegion                      = "region"                        // guild	string	region changed
	AuditLogChangeKeyAFKChannelID                = "afk_channel_id"                // guild	snowflake	afk channel changed
	AuditLogChangeKeyAFKTimeout                  = "afk_timeout"                   // guild	integer	afk timeout duration changed
	AuditLogChangeKeyMFALevel                    = "mfa_level"                     // guild	integer	two-factor auth requirement changed
	AuditLogChangeKeyVerificationLevel           = "verification_level"            // guild	integer	required verification level changed
	AuditLogChangeKeyExplicitContentFilter       = "explicit_content_filter"       // guild	integer	change in whose messages are scanned and deleted for explicit content in the server
	AuditLogChangeKeyDefaultMessageNotifications = "default_message_notifications" // guild	integer	default message notification level changed
	AuditLogChangeKeyVanityURLCode               = "vanity_url_code"               // guild	string	guild invite vanity url changed
	AuditLogChangeKeyAdd                         = "$add"                          // add	guild	array of role objects	new role added
	AuditLogChangeKeyRemove                      = "$remove"                       // remove	guild	array of role objects	role removed
	AuditLogChangeKeyPruneDeleteDays             = "prune_delete_days"             // guild	integer	change in number of days after which inactive and role-unassigned members are kicked
	AuditLogChangeKeyWidgetEnabled               = "widget_enabled"                // guild	bool	server widget enabled/disable
	AuditLogChangeKeyWidgetChannelID             = "widget_channel_id"             // guild	snowflake	channel id of the server widget changed
	AuditLogChangeKeyPosition                    = "position"                      // channel	integer	text or voice channel position changed
	AuditLogChangeKeyTopic                       = "topic"                         // channel	string	text channel topic changed
	AuditLogChangeKeyBitrate                     = "bitrate"                       // channel	integer	voice channel bitrate changed
	AuditLogChangeKeyPermissionOverwrites        = "permission_overwrites"         // channel	array of channel overwrite objects	permissions on a channel changed
	AuditLogChangeKeyNSFW                        = "nsfw"                          // channel	bool	channel nsfw restriction changed
	AuditLogChangeKeyApplicationID               = "application_id"                // channel	snowflake	application id of the added or removed webhook or bot
	AuditLogChangeKeyPermissions                 = "permissions"                   // role	integer	permissions for a role changed
	AuditLogChangeKeyColor                       = "color"                         // role	integer	role color changed
	AuditLogChangeKeyHoist                       = "hoist"                         // role	bool	role is now displayed/no longer displayed separate from online users
	AuditLogChangeKeyMentionable                 = "mentionable"                   // role	bool	role is now mentionable/unmentionable
	AuditLogChangeKeyAllow                       = "allow"                         // role	integer	a permission on a text or voice channel was allowed for a role
	AuditLogChangeKeyDeny                        = "deny"                          // role	integer	a permission on a text or voice channel was denied for a role
	AuditLogChangeKeyCode                        = "code"                          // invite	string	invite code changed
	AuditLogChangeKeyChannelID                   = "channel_id"                    // invite	snowflake	channel for invite code changed
	AuditLogChangeKeyInviterID                   = "inviter_id"                    // invite	snowflake	person who created invite code changed
	AuditLogChangeKeyMaxUses                     = "max_uses"                      // invite	integer	change to max number of times invite code can be used
	AuditLogChangeKeyUses                        = "uses"                          // invite	integer	number of times invite code used changed
	AuditLogChangeKeyMaxAge                      = "max_age"                       // invite	integer	how long invite code lasts changed
	AuditLogChangeKeyTemporary                   = "temporary"                     // invite	bool	invite code is temporary/never expires
	AuditLogChangeKeyDeaf                        = "deaf"                          // user	bool	user server deafened/undeafened
	AuditLogChangeKeyMute                        = "mute"                          // user	bool	user server muted/unmuteds
	AuditLogChangeKeyNick                        = "nick"                          // user	string	user nickname changed
	AuditLogChangeKeyAvatarHash                  = "avatar_hash"                   // user	string	user avatar changed
	AuditLogChangeKeyID                          = "id"                            // any	snowflake	the id of the changed entity - sometimes used in conjunction with other keys
	AuditLogChangeKeyType                        = "type"                          // any	integer (channel type) or string	type of entity created
)
View Source
const (
	// Channel types
	// https://discordapp.com/developers/docs/resources/channel#channel-object-channel-types
	ChannelTypeGuildText uint = iota
	ChannelTypeDM
	ChannelTypeGuildVoice
	ChannelTypeGroupDM
	ChannelTypeGuildCategory
)
View Source
const (
	MessageActivityTypeJoin
	MessageActivityTypeSpectate
	MessageActivityTypeListen
	MessageActivityTypeJoinRequest
)
View Source
const (
	MessageTypeDefault = iota
	MessageTypeRecipientAdd
	MessageTypeRecipientRemove
	MessageTypeCall
	MessageTypeChannelNameChange
	MessageTypeChannelIconChange
	MessageTypeChannelPinnedMessage
	MessageTypeGuildMemberJoin
)
View Source
const (
	ReadMessagesPermission = 1 << (iota + 10)
	SendMessagesPermission
	SendTTSMessagesPermission
	ManageMessagesPermission
	EmbedLinksPermission
	AttachFilesPermission
	ReadMessageHistoryPermission
	MentionEveryonePermission
	UseExternalEmojisPermission
)

Constants for the different bit offsets of text channel permissions

View Source
const (
	VoiceConnectPermission = 1 << (iota + 20)
	VoiceSpeakPermission
	VoiceMuteMembersPermission
	VoiceDeafenMembersPermission
	VoiceMoveMembersPermission
	VoiceUseVADPermission
)

Constants for the different bit offsets of voice permissions

View Source
const (
	ChangeNicknamePermission = 1 << (iota + 26)
	ManageNicknamesPermission
	ManageRolesPermission
	ManageWebhooksPermission
	ManageEmojisPermission
)

Constants for general management.

Constants for the different bit offsets of general permissions

View Source
const (
	// StatusIdle presence status for idle
	StatusIdle = "idle"
	// StatusDnd presence status for dnd
	StatusDnd = "dnd"
	// StatusOnline presence status for online
	StatusOnline = "online"
	// StatusOffline presence status for offline
	StatusOffline = "offline"
)
View Source
const (
	EndpointGuild = "/guilds/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	ID       Snowflake `json:"id"`
	Filename string    `json:"filename"`
	Size     uint      `json:"size"`
	URL      string    `json:"url"`
	ProxyURL string    `json:"proxy_url"`
	Height   uint      `json:"height"`
	Width    uint      `json:"width"`
}

Attachment https://discordapp.com/developers/docs/resources/channel#attachment-object

type AuditLog

type AuditLog struct {
	Webhooks        []*Webhook       `json:"webhooks"`
	Users           []*User          `json:"users"`
	AuditLogEntries []*AuditLogEntry `json:"audit_log_entries"`
}

type AuditLogChange

type AuditLogChange struct {
	NewValue interface{} `json:"new_value,omitempty"`
	OldValue interface{} `json:"old_value,omitempty"`
	Key      string      `json:"key"`
}

type AuditLogEntry

type AuditLogEntry struct {
	TargetID   Snowflake         `json:"target_id"`
	Changes    []*AuditLogChange `json:"changes,omitempty"`
	UserID     Snowflake         `json:"user_id"`
	ID         Snowflake         `json:"id"`
	ActionType uint              `json:"action_type"`
	Options    []*AuditLogOption `json:"options,omitempty"`
	Reason     string            `json:"reason,omitempty"`
}

type AuditLogOption

type AuditLogOption struct {
	DeleteMemberDays string    `json:"delete_member_days"`
	MembersRemoved   string    `json:"members_removed"`
	ChannelID        Snowflake `json:"channel_id"`
	Count            string    `json:"count"`
	ID               Snowflake `json:"id"`
	Type             string    `json:"type"` // type of overwritten entity ("member" or "role")
	RoleName         string    `json:"role_name"`
}

type Ban

type Ban struct {
	Reason string `json:"reason"`
	User   *User  `json:"user"`
}

-------------- Ban https://discordapp.com/developers/docs/resources/guild#ban-object

type Channel

type Channel struct {
	ID                   Snowflake             `json:"id"`
	Type                 uint                  `json:"type"`
	GuildID              Snowflake             `json:"guild_id,omitempty"`              // ?|
	Position             uint                  `json:"position,omitempty"`              // ?|
	PermissionOverwrites []PermissionOverwrite `json:"permission_overwrites,omitempty"` // ?|
	Name                 string                `json:"name,omitempty"`                  // ?|
	Topic                string                `json:"topic,omitempty"`                 // ?|
	NSFW                 bool                  `json:"nsfw,omitempty"`                  // ?|
	LastMessageID        Snowflake             `json:"last_message_id,omitempty"`       // ?|?, pointer
	Bitrate              uint                  `json:"bitrate,omitempty"`               // ?|
	UserLimit            uint                  `json:"user_limit,omitempty"`            // ?|
	Recipients           []*User               `json:"recipient,omitempty"`             // ?| , empty if not DM
	Icon                 string                `json:"icon,omitempty"`                  // ?|?, pointer
	OwnerID              Snowflake             `json:"owner_id,omitempty"`              // ?|
	ApplicationID        Snowflake             `json:"application_id,omitempty"`        // ?|
	ParentID             Snowflake             `json:"parent_id,omitempty"`             // ?|?, pointer
	LastPingTimestamp    Timestamp             `json:"last_ping_timestamp,omitempty"`   // ?|
	// contains filtered or unexported fields
}

Channel

func NewChannel

func NewChannel() *Channel

func (*Channel) Clear

func (c *Channel) Clear()

func (*Channel) Compare

func (c *Channel) Compare(other *Channel) bool

func (*Channel) Create

func (c *Channel) Create()

func (*Channel) DeepCopy

func (c *Channel) DeepCopy() *Channel

func (*Channel) Delete

func (c *Channel) Delete()

func (*Channel) Mention

func (c *Channel) Mention() string

func (*Channel) Replicate

func (c *Channel) Replicate(channel *Channel, recipients []*User)

func (*Channel) SendMsg

func (c *Channel) SendMsg(client ChannelMessager, msg *Message) (err error)

func (*Channel) SendMsgStr

func (c *Channel) SendMsgStr(client ChannelMessager, msgStr string) (msg *Message, err error)

func (*Channel) Update

func (c *Channel) Update()

type ChannelEmbed

type ChannelEmbed struct {
	Title       string                 `json:"title"`       // title of embed
	Type        string                 `json:"type"`        // type of embed (always "rich" for webhook embeds)
	Description string                 `json:"description"` // description of embed
	URL         string                 `json:"url"`         // url of embed
	Timestamp   time.Time              `json:"timestamp"`   // timestamp	timestamp of embed content
	Color       int                    `json:"color"`       // color code of the embed
	Footer      *ChannelEmbedFooter    `json:"footer"`      // embed footer object	footer information
	Image       *ChannelEmbedImage     `json:"image"`       // embed image object	image information
	Thumbnail   *ChannelEmbedThumbnail `json:"thumbnail"`   // embed thumbnail object	thumbnail information
	Video       *ChannelEmbedVideo     `json:"video"`       // embed video object	video information
	Provider    *ChannelEmbedProvider  `json:"provider"`    // embed provider object	provider information
	Author      *ChannelEmbedAuthor    `json:"author"`      // embed author object	author information
	Fields      []*ChannelEmbedField   `json:"fields"`      //	array of embed field objects	fields information
}

ChannelEmbed https://discordapp.com/developers/docs/resources/channel#embed-object

type ChannelEmbedAuthor

type ChannelEmbedAuthor struct {
	Name         string `json:"name,omitempty"`           // ?| , name of author
	Url          string `json:"url,omitempty"`            // ?| , url of author
	IconUrl      string `json:"icon_url,omitempty"`       // ?| , url of author icon (only supports http(s) and attachments)
	ProxyIconUrl string `json:"proxy_icon_url,omitempty"` // ?| , a proxied url of author icon
}

ChannelEmbedAuthor https://discordapp.com/developers/docs/resources/channel#embed-object-embed-author-structure

type ChannelEmbedField

type ChannelEmbedField struct {
	Name   string `json:"name"`           //  | , name of the field
	Value  string `json:"value"`          //  | , value of the field
	Inline bool   `json:"bool,omitempty"` // ?| , whether or not this field should display inline
}

ChannelEmbedField https://discordapp.com/developers/docs/resources/channel#embed-object-embed-field-structure

type ChannelEmbedFooter

type ChannelEmbedFooter struct {
	Text         string `json:"text"`                     //  | , url of author
	IconUrl      string `json:"icon_url,omitempty"`       // ?| , url of footer icon (only supports http(s) and attachments)
	ProxyIconUrl string `json:"proxy_icon_url,omitempty"` // ?| , a proxied url of footer icon
}

ChannelEmbedFooter https://discordapp.com/developers/docs/resources/channel#embed-object-embed-footer-structure

type ChannelEmbedImage

type ChannelEmbedImage struct {
	Url      string `json:"url,omitempty"`       // ?| , source url of image (only supports http(s) and attachments)
	ProxyUrl string `json:"proxy_url,omitempty"` // ?| , a proxied url of the image
	Height   int    `json:"height,omitempty"`    // ?| , height of image
	Width    int    `json:"width,omitempty"`     // ?| , width of image
}

ChannelEmbedImage https://discordapp.com/developers/docs/resources/channel#embed-object-embed-image-structure

type ChannelEmbedProvider

type ChannelEmbedProvider struct {
	Name string `json:"name,omitempty"` // ?| , name of provider
	Url  string `json:"url,omitempty"`  // ?| , url of provider
}

ChannelEmbedProvider https://discordapp.com/developers/docs/resources/channel#embed-object-embed-provider-structure

type ChannelEmbedThumbnail

type ChannelEmbedThumbnail struct {
	Url      string `json:"url,omitempty"`       // ?| , source url of image (only supports http(s) and attachments)
	ProxyUrl string `json:"proxy_url,omitempty"` // ?| , a proxied url of the image
	Height   int    `json:"height,omitempty"`    // ?| , height of image
	Width    int    `json:"width,omitempty"`     // ?| , width of image
}

ChannelEmbedThumbnail https://discordapp.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure

type ChannelEmbedVideo

type ChannelEmbedVideo struct {
	Url    string `json:"url,omitempty"`    // ?| , source url of video
	Height int    `json:"height,omitempty"` // ?| , height of video
	Width  int    `json:"width,omitempty"`  // ?| , width of video
}

ChannelEmbedVideo https://discordapp.com/developers/docs/resources/channel#embed-object-embed-video-structure

type ChannelMessager

type ChannelMessager interface {
	CreateMessage(*Message) error // TODO: check cache for `SEND_MESSAGES` and `SEND_TTS_MESSAGES` permissions before sending.
}

ChannelMessager Methods required to create a new DM (or use an existing one) and send a DM.

type DefaultMessageNotificationLvl

type DefaultMessageNotificationLvl uint

DefaultMessageNotification ... https://discordapp.com/developers/docs/resources/guild#guild-object-default-message-notification-level

func (*DefaultMessageNotificationLvl) AllMessages

func (dmnl *DefaultMessageNotificationLvl) AllMessages() bool

func (*DefaultMessageNotificationLvl) Equals

func (dmnl *DefaultMessageNotificationLvl) Equals(v uint) bool

func (*DefaultMessageNotificationLvl) OnlyMentions

func (dmnl *DefaultMessageNotificationLvl) OnlyMentions() bool

type DeletedMessage

type DeletedMessage struct {
	ID        Snowflake `json:"id"`
	ChannelID Snowflake `json:"channel_id"`
}

func NewDeletedMessage

func NewDeletedMessage() *DeletedMessage

type Emoji

type Emoji struct {
	ID            Snowflake   `json:"id"`
	Name          string      `json:"name"`
	Roles         []Snowflake `json:"roles,omitempty"`
	User          *User       `json:"user,omitempty"` // the user who created the emoji
	RequireColons bool        `json:"require_colons,omitempty"`
	Managed       bool        `json:"managed,omitempty"`
	Animated      bool        `json:"animated,omitempty"`
}

Emoji

func (*Emoji) Clear

func (e *Emoji) Clear()

func (*Emoji) Mention

func (e *Emoji) Mention() string

Mention TODO: review

func (*Emoji) MentionAnimated

func (e *Emoji) MentionAnimated() string

MentionAnimated add the animation prefix if a animated emoji TODO: review

type ExplicitContentFilterLvl

type ExplicitContentFilterLvl uint

ExplicitContentFilterLvl ... https://discordapp.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level

func (*ExplicitContentFilterLvl) AllMembers

func (ecfl *ExplicitContentFilterLvl) AllMembers() bool

func (*ExplicitContentFilterLvl) Disabled

func (ecfl *ExplicitContentFilterLvl) Disabled() bool

func (*ExplicitContentFilterLvl) MembersWithoutRoles

func (ecfl *ExplicitContentFilterLvl) MembersWithoutRoles() bool

type Guild

type Guild struct {
	ID                          Snowflake                     `json:"id"`
	ApplicationID               *Snowflake                    `json:"application_id"` //   |?
	Name                        string                        `json:"name"`
	Icon                        *string                       `json:"icon"`            //  |?, icon hash
	Splash                      *string                       `json:"splash"`          //  |?, image hash
	Owner                       bool                          `json:"owner,omitempty"` // ?|
	OwnerID                     Snowflake                     `json:"owner_id"`
	Permissions                 uint64                        `json:"permissions,omitempty"` // ?|, permission flags for connected user `/users/@me/guilds`
	Region                      string                        `json:"region"`
	AfkChannelID                *Snowflake                    `json:"afk_channel_id"` // |?
	AfkTimeout                  uint                          `json:"afk_timeout"`
	EmbedEnabled                bool                          `json:"embed_enabled,omit_empty"`
	EmbedChannelID              Snowflake                     `json:"embed_channel_id,omit_empty"`
	VerificationLevel           VerificationLvl               `json:"verification_level"`
	DefaultMessageNotifications DefaultMessageNotificationLvl `json:"default_message_notifications"`
	ExplicitContentFilter       ExplicitContentFilterLvl      `json:"explicit_content_filter"`
	Roles                       []*Role                       `json:"roles"`
	Emojis                      []*Emoji                      `json:"emojis"`
	Features                    []string                      `json:"features"`
	MFALevel                    MFALvl                        `json:"mfa_level"`
	WidgetEnabled               bool                          `json:"widget_enabled,omit_empty"`    //   |
	WidgetChannelID             Snowflake                     `json:"widget_channel_id,omit_empty"` //   |
	SystemChannelID             *Snowflake                    `json:"system_channel_id,omitempty"`  //   |?

	// JoinedAt must be a pointer, as we can't hide non-nil structs
	JoinedAt       *Timestamp      `json:"joined_at,omitempty"`    // ?*|
	Large          bool            `json:"large,omitempty"`        // ?*|
	Unavailable    bool            `json:"unavailable"`            // ?*| omitempty?
	MemberCount    uint            `json:"member_count,omitempty"` // ?*|
	VoiceStates    []*VoiceState   `json:"voice_states,omitempty"` // ?*|
	Members        []*Member       `json:"members,omitempty"`      // ?*|
	Channels       []*Channel      `json:"channels,omitempty"`     // ?*|
	Presences      []*UserPresence `json:"presences,omitempty"`    // ?*|
	PresencesMutex sync.RWMutex    `json:"-"`
	// contains filtered or unexported fields
}

func NewGuild

func NewGuild() *Guild

func NewGuildFromJSON

func NewGuildFromJSON(data []byte) *Guild

func NewGuildFromUnavailable

func NewGuildFromUnavailable(gu *GuildUnavailable) *Guild

func NewPartialGuild

func NewPartialGuild(ID Snowflake) *Guild

func (*Guild) AddChannel

func (g *Guild) AddChannel(c *Channel) error

func (*Guild) AddMember

func (g *Guild) AddMember(member *Member) error

func (*Guild) AddRole

func (g *Guild) AddRole(role *Role) error

func (*Guild) Channel

func (g *Guild) Channel(id Snowflake) (*Channel, error)

func (*Guild) Clear

func (g *Guild) Clear()

Clear all the pointers

func (*Guild) Compare

func (g *Guild) Compare(other *Guild) bool

Compare two guild objects

func (*Guild) DeepCopy

func (g *Guild) DeepCopy() *Guild

func (*Guild) DeleteChannel

func (g *Guild) DeleteChannel(c *Channel) error

func (*Guild) DeleteChannelByID

func (g *Guild) DeleteChannelByID(ID Snowflake) error

func (*Guild) DeleteRoleByID

func (g *Guild) DeleteRoleByID(ID Snowflake)

func (*Guild) MarshalJSON

func (g *Guild) MarshalJSON() ([]byte, error)

TODO: fix copying of mutex lock

func (*Guild) Member

func (g *Guild) Member(id Snowflake) (*Member, error)

Member return a member by his/her userid

func (*Guild) MemberByName

func (g *Guild) MemberByName(name string) ([]*Member, error)

MemberByName retrieve a slice of members with same username or nickname

func (*Guild) Role

func (g *Guild) Role(id Snowflake) (*Role, error)

Role retrieve a role based on role id

func (*Guild) RoleByName

func (g *Guild) RoleByName(name string) ([]*Role, error)

RoleByTitle retrieves a slice of roles with same name

func (*Guild) Update

func (g *Guild) Update(new *Guild)

Update update the reference content

func (*Guild) UpdatePresence

func (g *Guild) UpdatePresence(p *UserPresence)

func (*Guild) UpdateRole

func (g *Guild) UpdateRole(r *Role)

type GuildEmbed

type GuildEmbed struct {
	Enabled   bool      `json:"enabled"`
	ChannelID Snowflake `json:"channel_id"`
}

------------ GuildEmbed https://discordapp.com/developers/docs/resources/guild#guild-embed-object

type GuildInterface

type GuildInterface interface {
	Channel(ID Snowflake)
}

type GuildPruneCount

type GuildPruneCount struct {
	Pruned int `json:"pruned"`
}

type GuildUnavailable

type GuildUnavailable struct {
	ID           Snowflake `json:"id"`
	Unavailable  bool      `json:"unavailable"` // ?*|
	sync.RWMutex `json:"-"`
}

func NewGuildUnavailable

func NewGuildUnavailable(ID Snowflake) *GuildUnavailable

type Integration

type Integration struct {
	ID                Snowflake           `json:"id"`
	Name              string              `json:"name"`
	Type              string              `json:"type"`
	Enabled           bool                `json:"enabled"`
	Syncing           bool                `json:"syncing"`
	RoleID            Snowflake           `json:"role_id"`
	ExpireBehavior    int                 `json:"expire_behavior"`
	ExpireGracePeriod int                 `json:"expire_grace_period"`
	User              *User               `json:"user"`
	Account           *IntegrationAccount `json:"account"`
}

------- Integration https://discordapp.com/developers/docs/resources/guild#integration-object

type IntegrationAccount

type IntegrationAccount struct {
	ID   string `json:"id"`   // id of the account
	Name string `json:"name"` // name of the account
}

IntegrationAccount https://discordapp.com/developers/docs/resources/guild#integration-account-object

type Invite

type Invite struct {
	// Code the invite code (unique Snowflake)
	Code string `json:"code"`

	// Guild the guild this invite is for
	Guild *PartialGuild `json:"guild"`

	// Channel the channel this invite is for
	Channel *PartialChannel `json:"channel"`

	// ApproximatePresenceCount approximate count of online members
	ApproximatePresenceCount int `json:"approximate_presence_count,omitempty"`

	// ApproximatePresenceCount approximate count of total members
	ApproximateMemberCount int `json:"approximate_member_count,omitempty"`
}

Invite Represents a code that when used, adds a user to a guild. https://discordapp.com/developers/docs/resources/invite#invite-object Reviewed: 2018-06-10

type InviteMetadata

type InviteMetadata struct {
	// Inviter user who created the invite
	Inviter *User `json:"inviter"`

	// Uses number of times this invite has been used
	Uses int `json:"uses"`

	// MaxUses max number of times this invite can be used
	MaxUses int `json:"max_uses"`

	// MaxAge duration (in seconds) after which the invite expires
	MaxAge int `json:"max_age"`

	// Temporary whether this invite only grants temporary membership
	Temporary bool `json:"temporary"`

	// CreatedAt when this invite was created
	CreatedAt Timestamp `json:"created_at"`

	// Revoked whether this invite is revoked
	Revoked bool `json:"revoked"`
}

InviteMetadata Object https://discordapp.com/developers/docs/resources/invite#invite-metadata-object Reviewed: 2018-06-10

type MFALvl

type MFALvl uint

MFA ... https://discordapp.com/developers/docs/resources/guild#guild-object-mfa-level

func (*MFALvl) Elevated

func (mfal *MFALvl) Elevated() bool

func (*MFALvl) None

func (mfal *MFALvl) None() bool

type Marshaler

type Marshaler interface {
	MarshalJSON() ([]byte, error)
}

type Member

type Member struct {
	GuildID  Snowflake   `json:"guild_id,omitempty"`
	User     *User       `json:"user"`
	Nick     string      `json:"nick,omitempty"` // ?|
	Roles    []Snowflake `json:"roles"`
	JoinedAt Timestamp   `json:"joined_at,omitempty"`
	Deaf     bool        `json:"deaf"`
	Mute     bool        `json:"mute"`

	sync.RWMutex `json:"-"`
}

Member https://discordapp.com/developers/docs/resources/guild#guild-member-object

func (*Member) Clear

func (m *Member) Clear() Snowflake

func (*Member) Update

func (m *Member) Update(new *Member) (err error)

type Message

type Message struct {
	ID              Snowflake          `json:"id"`
	ChannelID       Snowflake          `json:"channel_id"`
	Author          *User              `json:"author"`
	Content         string             `json:"content"`
	Timestamp       time.Time          `json:"timestamp"`
	EditedTimestamp time.Time          `json:"edited_timestamp"` // ?
	Tts             bool               `json:"tts"`
	MentionEveryone bool               `json:"mention_everyone"`
	Mentions        []*User            `json:"mentions"`
	MentionRoles    []Snowflake        `json:"mention_roles"`
	Attachments     []*Attachment      `json:"attachments"`
	Embeds          []*ChannelEmbed    `json:"embeds"`
	Reactions       []*Reaction        `json:"reactions"` // ?
	Nonce           Snowflake          `json:"nonce"`     // ?, used for validating a message was sent
	Pinned          bool               `json:"pinned"`
	WebhookID       Snowflake          `json:"webhook_id"` // ?
	Type            uint               `json:"type"`
	Activity        MessageActivity    `json:"activity"`
	Application     MessageApplication `json:"application"`

	sync.RWMutex `json:"-"`
}

Message https://discordapp.com/developers/docs/resources/channel#message-object-message-structure

func NewMessage

func NewMessage() *Message

func (*Message) AddReaction

func (m *Message) AddReaction(reaction *Reaction)

func (*Message) Delete

func (m *Message) Delete()

func (*Message) MarshalJSON

func (m *Message) MarshalJSON() ([]byte, error)

func (*Message) RemoveReaction

func (m *Message) RemoveReaction(id Snowflake)

func (*Message) Send

func (m *Message) Send()

func (*Message) Update

func (m *Message) Update()

type MessageActivity

type MessageActivity struct {
	Type    int    `json:"type"`
	PartyID string `json:"party_id"`
}

https://discordapp.com/developers/docs/resources/channel#message-object-message-activity-structure

type MessageApplication

type MessageApplication struct {
	ID          Snowflake `json:"id"`
	CoverImage  string    `json:"cover_image"`
	Description string    `json:"description"`
	Icon        string    `json:"icon"`
	Name        string    `json:"name"`
}

https://discordapp.com/developers/docs/resources/channel#message-object-message-application-structure

type PartialChannel

type PartialChannel = Channel

type PartialEmoji

type PartialEmoji = Emoji

type PartialGuild

type PartialGuild = Guild

Guild Guilds in Discord represent an isolated collection of users and channels,

and are often referred to as "servers" in the UI.

https://discordapp.com/developers/docs/resources/guild#guild-object Fields with `*` are only sent within the GUILD_CREATE event TODO: lazyload everything reviewed: 2018-08-25

type PartialInvite

type PartialInvite = Invite

PartialInvite

{
   "code": "abc"
}

type PermissionOverwrite

type PermissionOverwrite struct {
	ID    Snowflake `json:"id"`    // role or user id
	Type  string    `json:"type"`  // either `role` or `member`
	Allow int       `json:"allow"` // permission bit set
	Deny  int       `json:"deny"`  // permission bit set
}

Overwrite: https://discordapp.com/developers/docs/resources/channel#overwrite-object

func (*PermissionOverwrite) Clear

func (pmo *PermissionOverwrite) Clear()

type Reaction

type Reaction struct {
	Count uint          `json:"count"`
	Me    bool          `json:"me"`
	Emoji *PartialEmoji `json:"Emoji"`
}

https://discordapp.com/developers/docs/resources/channel#reaction-object

type Role

type Role struct {
	ID          Snowflake `json:"id"`
	Name        string    `json:"name"`
	Color       int       `json:"color"`
	Hoist       bool      `json:"hoist"`
	Position    int       `json:"position"`
	Permissions uint64    `json:"permissions"`
	Managed     bool      `json:"managed"`
	Mentionable bool      `json:"mentionable"`
}

Role https://discordapp.com/developers/docs/topics/permissions#role-object

func NewRole

func NewRole() *Role

func (*Role) Clear

func (r *Role) Clear()

func (*Role) Mention

func (r *Role) Mention() string

type Timestamp

type Timestamp time.Time

func (Timestamp) String

func (t Timestamp) String() string

String converts the timestamp into a discord formatted timestamp. time.RFC3331 does not suffice

func (Timestamp) Time

func (t Timestamp) Time() time.Time

Time converts the DiscordTimestamp into a time.Time type.......

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) error

type Unmarshaler

type Unmarshaler interface {
	UnmarshalJSON(data []byte) error
}

type User

type User struct {
	ID            Snowflake `json:"id,omitempty"`
	Username      string    `json:"username,omitempty"`
	Discriminator string    `json:"discriminator,omitempty"`
	Email         string    `json:"email,omitempty"`
	Avatar        *string   `json:"avatar"` // data:image/jpeg;base64,BASE64_ENCODED_JPEG_IMAGE_DATA //TODO: pointer?
	Token         string    `json:"token,omitempty"`
	Verified      bool      `json:"verified,omitempty"`
	MFAEnabled    bool      `json:"mfa_enabled,omitempty"`
	Bot           bool      `json:"bot,omitempty"`

	sync.RWMutex `json:"-"`
}

func NewUser

func NewUser() *User

TODO: should a user object always have a Snowflake?

func (*User) Clear

func (u *User) Clear()

func (*User) DeepCopy

func (u *User) DeepCopy() *User

func (*User) MarshalJSON

func (u *User) MarshalJSON() ([]byte, error)

func (*User) Mention

func (u *User) Mention() string

func (*User) MentionNickname

func (u *User) MentionNickname() string

func (*User) Partial

func (u *User) Partial() bool

Partial check if this is not a complete user object Assumption: has a snowflake.

func (*User) SendMsg

func (u *User) SendMsg(requester httd.Requester, msg *Message) (channelID Snowflake, messageID Snowflake, err error)

func (*User) SendMsgString

func (u *User) SendMsgString(requester httd.Requester, msg string) (channelID Snowflake, messageID Snowflake, err error)

func (*User) String

func (u *User) String() string

func (*User) Valid

func (u *User) Valid() bool

type UserConnection

type UserConnection struct {
	ID           string                `json:"id"`           // id of the connection account
	Name         string                `json:"name"`         // the username of the connection account
	Type         string                `json:"type"`         // the service of the connection (twitch, youtube)
	Revoked      bool                  `json:"revoked"`      // whether the connection is revoked
	Integrations []*IntegrationAccount `json:"integrations"` // an array of partial server integrations
}

type UserInterface

type UserInterface interface {
	Mention() string
	MentionNickname() string
	String() string
}

type UserPresence

type UserPresence struct {
	User    *User         `json:"user"`
	Roles   []Snowflake   `json:"roles"`
	Game    *UserActivity `json:"activity"`
	GuildID Snowflake     `json:"guild_id"`
	Nick    string        `json:"nick"`
	Status  string        `json:"status"`
}

func NewUserPresence

func NewUserPresence() *UserPresence

func (*UserPresence) Clear

func (p *UserPresence) Clear()

func (*UserPresence) String

func (p *UserPresence) String() string

func (*UserPresence) Update

func (p *UserPresence) Update(status string)

type VerificationLvl

type VerificationLvl uint

Verification ... https://discordapp.com/developers/docs/resources/guild#guild-object-verification-level

func (*VerificationLvl) High

func (vl *VerificationLvl) High() bool

High (╯°□°)╯︵ ┻━┻ - must be a member of the server for longer than 10 minutes

func (*VerificationLvl) Low

func (vl *VerificationLvl) Low() bool

Low must have verified email on account

func (*VerificationLvl) Medium

func (vl *VerificationLvl) Medium() bool

Medium must be registered on Discord for longer than 5 minutes

func (*VerificationLvl) None

func (vl *VerificationLvl) None() bool

None unrestricted

func (*VerificationLvl) VeryHigh

func (vl *VerificationLvl) VeryHigh() bool

VeryHigh ┻━┻ミヽ(ಠ益ಠ)ノ彡┻━┻ - must have a verified phone number

type VoiceRegion

type VoiceRegion struct {
	// Snowflake unique Snowflake for the region
	ID Snowflake `json:"id"`

	// Name name of the region
	Name string `json:"name"`

	// SampleHostname an example hostname for the region
	SampleHostname string `json:"sample_hostname"`

	// SamplePort an example port for the region
	SamplePort uint `json:"sample_port"`

	// VIP true if this is a vip-only server
	VIP bool `json:"vip"`

	// Optimal true for a single server that is closest to the current user's client
	Optimal bool `json:"optimal"`

	// Deprecated 	whether this is a deprecated voice region (avoid switching to these)
	Deprecated bool `json:"deprecated"`

	// Custom whether this is a custom voice region (used for events/etc)
	Custom bool `json:"custom"`
}

Region voice region structure https://discordapp.com/developers/docs/resources/voice#voice-region

type VoiceState

type VoiceState struct {
	// GuildID the guild id this voice state is for
	GuildID Snowflake `json:"guild_id,omitempty"` // ? |

	// ChannelID the channel id this user is connected to
	ChannelID Snowflake `json:"channel_id"` // |

	// UserID the user id this voice state is for
	UserID Snowflake `json:"user_id"` // |

	// SessionID the session id for this voice state
	SessionID string `json:"session_id"` // |

	// Deaf whether this user is deafened by the server
	Deaf bool `json:"deaf"` // |

	// Mute whether this user is muted by the server
	Mute bool `json:"mute"` // |

	// SelfDeaf whether this user is locally deafened
	SelfDeaf bool `json:"self_deaf"` // |

	// SelfMute whether this user is locally muted
	SelfMute bool `json:"self_mute"` // |

	// Suppress whether this user is muted by the current user
	Suppress bool `json:"suppress"` // |
}

State Voice State structure https://discordapp.com/developers/docs/resources/voice#voice-state-object

func (*VoiceState) Clear

func (vst *VoiceState) Clear()

type Webhook

type Webhook struct {
	ID        Snowflake `json:"id"`                 //  |
	GuildID   Snowflake `json:"guild_id,omitempty"` //  |?
	ChannelID Snowflake `json:"channel_id"`         //  |
	User      *User     `json:"user,omitempty"`     // ?|
	Name      string    `json:"name"`               //  |?
	Avatar    string    `json:"avatar"`             //  |?
	Token     string    `json:"token"`              //  |
}

Webhook Used to represent a webhook https://discordapp.com/developers/docs/resources/webhook#webhook-object

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL