discord

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleMentionType     AllowedMentionType = "roles"
	UserMentionType                        = "users"
	EveryoneMentionType                    = "everyone"
)
View Source
const (
	GuildTextChannelType ChannelType = iota
	DMChannelType
	GuildVoiceChannelType
	GroupDMChannelType
	GuildCategoryChannelType
	GuildAnnouncementChannelType
	AnnouncementThreadChannelType = iota + 4
	PublicThreadChannelType
	PrivateThreadChannelType
	GuildStageVoiceChannelType
	GuildDirectoryChannelType
	GuildForumChannelType
)
View Source
const (
	DefaultMessageType MessageType = iota
	RecipientAddMessageType
	RecipientRemoveMessageType
	CallMessageType
	ChannelNameChangeMessageType
	ChannelIconChangeMessageType
	ChannelPinnedMessageMessageType
	GuildMemberJoinMessageType
	GuildBoostMessageType
	GuildBoostTier1MessageType
	GuildBoostTier2MessageType
	GuildBoostTier3MessageType
	ChannelFollowAddMessageType
	GuildDiscoveryDisqualifiedMessageType = iota + 1
	GuildDiscoveryReQualifiedMessageType
	GuildDiscoveryGracePeriodInitialWarningMessageType
	GuildDiscoveryGracePeriodFinalWarningMessageType
	ThreadCreatedMessageType
	ReplyMessageType
	ChatInputCommandMessageType
	ThreadStarterMessageMessageType
	GuildInviteReminderMessageType
	ContextMenuCommandMessageType
	AutoModerationActionMessageType
	RoleSubscriptionPurchaseMessageType
	InteractionPremiumUpsellMessageType
	GuildApplicationPremiumSubscriptionMessageType = iota + 6
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowedMentionType

type AllowedMentionType string

type AllowedMentions

type AllowedMentions struct {
	Parse       []AllowedMentionType `json:"parse"`
	Roles       []Snowflake          `json:"roles"`
	Users       []Snowflake          `json:"users"`
	RepliedUser bool                 `json:"replied_user"`
}

type Application added in v0.1.4

type Application struct {
	Id                             Snowflake      `json:"id"`
	Name                           string         `json:"name"`
	Icon                           string         `json:"icon"`
	Description                    string         `json:"description"`
	RpcOrigins                     *[]string      `json:"rpc_origins,omitempty"`
	BotPublic                      bool           `json:"bot_public"`
	BotRequireCodeGrant            bool           `json:"bot_require_code_grant"`
	TermsOfServiceUrl              *string        `json:"terms_of_service_url,omitempty"`
	PrivacyPolicyUrl               *string        `json:"privacy_policy_url,omitempty"`
	Owner                          *User          `json:"owner,omitempty"`
	VerifyKey                      string         `json:"verify_key"`
	Team                           *Team          `json:"team,omitempty"`
	GuildId                        *Snowflake     `json:"guild_id,omitempty"`
	PrimarySkuId                   *Snowflake     `json:"primary_sku_id,omitempty"`
	Slug                           *string        `json:"slug,omitempty"`
	CoverImage                     *string        `json:"cover_image,omitempty"`
	Flags                          *uint          `json:"flags,omitempty"`
	Tags                           *[]string      `json:"tags,omitempty"`
	InstallParams                  *InstallParams `json:"install_params,omitempty"`
	CustomInstallUrl               *string        `json:"custom_install_url,omitempty"`
	RoleConnectionsVerificationUrl *string        `json:"role_connections_verification_url,omitempty"`
}

type Attachment

type Attachment struct {
	ID          Snowflake `json:"id"`
	Filename    string    `json:"filename"`
	Description *string   `json:"description,omitempty"`
	ContentType *string   `json:"content_type,omitempty"`
	Size        int       `json:"size"`
	URL         string    `json:"url"`
	ProxyURL    string    `json:"proxy_url"`
	Height      *int      `json:"height,omitempty"`
	Width       *int      `json:"width,omitempty"`
	Ephemeral   *bool     `json:"ephemeral,omitempty"`
}

type Channel added in v0.1.9

type Channel struct {
	Id                            Snowflake        `json:"id"`
	Type                          ChannelType      `json:"type"`
	GuildId                       *Snowflake       `json:"guild_id,omitempty"`
	Position                      *int             `json:"position,omitempty"`
	PermissionOverwrites          *[]Overwrite     `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"`
	Bitrate                       *int             `json:"bitrate,omitempty"`
	UserLimit                     *int             `json:"user_limit,omitempty"`
	RateLimitPerUser              *int             `json:"rate_limit_per_user,omitempty"`
	Recipients                    *[]User          `json:"recipients,omitempty"`
	Icon                          *string          `json:"icon,omitempty"`
	OwnerId                       *Snowflake       `json:"owner_id,omitempty"`
	ApplicationId                 *Snowflake       `json:"application_id,omitempty"`
	Managed                       *bool            `json:"managed,omitempty"`
	ParentId                      *Snowflake       `json:"parent_id,omitempty"`
	LastPinTimestamp              *time.Time       `json:"last_pin_timestamp,omitempty"`
	RtcRegion                     *string          `json:"rtc_region,omitempty"`
	VideoQualityMode              *int             `json:"video_quality_mode,omitempty"`
	MessageCount                  *int             `json:"message_count,omitempty"`
	MemberCount                   *int             `json:"member_count,omitempty"`
	ThreadMetadata                *ThreadMetadata  `json:"thread_metadata,omitempty"`
	Member                        *ThreadMember    `json:"member,omitempty"`
	DefaultAutoArchiveDuration    *int             `json:"default_auto_archive_duration,omitempty"`
	Permissions                   *string          `json:"permissions,omitempty"`
	Flags                         *int             `json:"flags,omitempty"`
	TotalMessageSent              *int             `json:"total_message_sent,omitempty"`
	AvailableTags                 *[]Tag           `json:"available_tags,omitempty"`
	AppliedTags                   *[]Snowflake     `json:"applied_tags,omitempty"`
	DefaultReactionEmoji          *DefaultReaction `json:"default_reaction_emoji,omitempty"`
	DefaultThreadRateLimitPerUser *int             `json:"default_thread_rate_limit_per_user,omitempty"`
	DefaultSortOrder              *int             `json:"default_sort_order,omitempty"`
	DefaultForumLayout            *int             `json:"default_forum_layout,omitempty"`
}

type ChannelMention added in v0.1.4

type ChannelMention struct {
	Id      Snowflake   `json:"id"`
	GuildId Snowflake   `json:"guild_id"`
	Type    ChannelType `json:"type"`
	Name    string      `json:"name"`
}

type ChannelType added in v0.1.4

type ChannelType uint8

type DefaultReaction added in v0.1.9

type DefaultReaction struct {
	EmojiId   *Snowflake `json:"emoji_id,omitempty"`
	EmojiName *string    `json:"emoji_name,omitempty"`
}

type Embed

type Embed struct {
	Title       string         `json:"title,omitempty"`
	Type        string         `json:"type,omitempty"`
	Description string         `json:"description,omitempty"`
	URL         string         `json:"url,omitempty"`
	Timestamp   string         `json:"timestamp,omitempty"`
	Color       int            `json:"color,omitempty"`
	Footer      *EmbedFooter   `json:"footer,omitempty"`
	Image       *EmbedImage    `json:"image,omitempty"`
	Thumbnail   *EmbedImage    `json:"thumbnail,omitempty"`
	Video       *EmbedVideo    `json:"video,omitempty"`
	Provider    *EmbedProvider `json:"provider,omitempty"`
	Author      *EmbedAuthor   `json:"author,omitempty"`
	Fields      []EmbedField   `json:"fields,omitempty"`
}

type EmbedAuthor

type EmbedAuthor struct {
	Name         string `json:"name,omitempty"`
	URL          string `json:"url,omitempty"`
	IconURL      string `json:"icon_url,omitempty"`
	ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}

type EmbedField

type EmbedField struct {
	Name   string `json:"name"`
	Value  string `json:"value"`
	Inline bool   `json:"inline,omitempty"`
}

type EmbedFooter

type EmbedFooter struct {
	Text         string `json:"text"`
	IconURL      string `json:"icon_url,omitempty"`
	ProxyIconURL string `json:"proxy_icon_url,omitempty"`
}

type EmbedImage

type EmbedImage struct {
	URL      string `json:"url"`
	ProxyURL string `json:"proxy_url,omitempty"`
	Height   int    `json:"height,omitempty"`
	Width    int    `json:"width,omitempty"`
}

type EmbedProvider

type EmbedProvider struct {
	Name string `json:"name,omitempty"`
	URL  string `json:"url,omitempty"`
}

type EmbedVideo

type EmbedVideo struct {
	URL      string `json:"url"`
	ProxyURL string `json:"proxy_url,omitempty"`
	Height   int    `json:"height,omitempty"`
	Width    int    `json:"width,omitempty"`
}

type Emoji

type Emoji struct {
	Id            *Snowflake  `json:"id,omitempty"`
	Name          *string     `json:"name,omitempty"`
	Roles         []Snowflake `json:"roles,omitempty"`
	User          *User       `json:"user,omitempty"`
	RequireColons *bool       `json:"require_colons,omitempty"`
	Managed       *bool       `json:"managed,omitempty"`
	Animated      *bool       `json:"animated,omitempty"`
	Available     *bool       `json:"available,omitempty"`
}

type InstallParams added in v0.1.4

type InstallParams struct {
	Scopes      []string `json:"scopes"`
	Permissions string   `json:"permissions"`
}

type Member

type Member struct {
	User                       *User        `json:"user,omitempty"`
	Nick                       *string      `json:"nick,omitempty"`
	Avatar                     *string      `json:"avatar,omitempty"`
	Roles                      []Snowflake  `json:"roles"`
	JoinedAt                   time.Time    `json:"joined_at"`
	PremiumSince               *time.Time   `json:"premium_since,omitempty"`
	Deaf                       bool         `json:"deaf"`
	Mute                       bool         `json:"mute"`
	Pending                    *bool        `json:"pending,omitempty"`
	Permissions                *Permissions `json:"permissions,omitempty"`
	CommunicationDisabledUntil *time.Time   `json:"communication_disabled_until,omitempty"`
}

type Message added in v0.1.4

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"`
	MentionChannels []ChannelMention `json:"mention_channels"`
	Attachments     []Attachment     `json:"attachments"`
	Embeds          []Embed          `json:"embeds"`
	Reactions       *[]Reaction      `json:"reactions,omitempty"`
	Nonce           interface{}      `json:"nonce,omitempty"`
	Pinned          bool             `json:"pinned"`
	WebhookId       *Snowflake       `json:"webhook_id,omitempty"`
	Type            MessageType      `json:"type"`
}

type MessageActivity added in v0.1.4

type MessageActivity struct {
	Type    MessageActivityType `json:"type"`
	PartyId string              `json:"party_id"`
}

type MessageActivityType added in v0.1.4

type MessageActivityType int
const (
	JoinMessageActivityType MessageActivityType = iota + 1
	SpectateMessageActivityType
	ListenMessageActivityType
	JoinRequestMessageActivityType
)

type MessageType added in v0.1.4

type MessageType uint8

type Overwrite added in v0.1.9

type Overwrite struct {
	Id    Snowflake     `json:"id"`
	Type  OverwriteType `json:"type"`
	Allow string        `json:"allow"`
	Deny  string        `json:"deny"`
}

type OverwriteType added in v0.1.9

type OverwriteType uint8
const (
	RoleOverwriteType OverwriteType = iota
	MemberOverwriteType
)

type Permissions

type Permissions uint64

func (*Permissions) MarshalJSON

func (i *Permissions) MarshalJSON() ([]byte, error)

func (*Permissions) UnmarshalJSON

func (i *Permissions) UnmarshalJSON(b []byte) error

type Reaction added in v0.1.4

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

type ResolvedData

type ResolvedData struct {
	Users    *map[string]*User    `json:"users,omitempty"`
	Members  *map[string]*Member  `json:"members,omitempty"`
	Roles    *map[string]*Role    `json:"roles,omitempty"`
	Channels *map[string]*Channel `json:"channels,omitempty"`
}

type Role

type Role struct {
	Id           Snowflake   `json:"id"`
	Name         string      `json:"name"`
	Color        int         `json:"color"`
	Hoist        bool        `json:"hoist"`
	Icon         *string     `json:"icon,omitempty"`
	UnicodeEmoji *string     `json:"unicode_emoji,omitempty"`
	Position     int         `json:"position"`
	Permissions  Permissions `json:"permissions"`
	Managed      bool        `json:"managed"`
	Mentionable  bool        `json:"mentionable"`
	Tags         *RoleTags   `json:"tags,omitempty"`
}

type RoleTags

type RoleTags struct {
	BotId                 *Snowflake `json:"bot_id,omitempty"`
	IntegrationId         *Snowflake `json:"integration_id,omitempty"`
	SubscriptionListingId *Snowflake `json:"subscription_listing_id,omitempty"`
	// These fields should be set to "null" in the JSON if they are true, according to the Discord docs...
	PremiumSubscriber    bool `json:"premium_subscriber,omitempty"`
	AvailableForPurchase bool `json:"available_for_purchase,omitempty"`
	GuildConnections     bool `json:"guild_connections,omitempty"`
}

func (*RoleTags) MarshalJSON

func (tags *RoleTags) MarshalJSON() ([]byte, error)

func (*RoleTags) UnmarshalJSON

func (tags *RoleTags) UnmarshalJSON(b []byte) error

type Snowflake

type Snowflake uint64

func GetSnowflake

func GetSnowflake(id interface{}) (Snowflake, error)

func (*Snowflake) MarshalJSON

func (i *Snowflake) MarshalJSON() ([]byte, error)

func (*Snowflake) UnmarshalJSON

func (i *Snowflake) UnmarshalJSON(b []byte) error

type Tag added in v0.1.9

type Tag struct {
	Id        Snowflake  `json:"id"`
	Name      string     `json:"name"`
	Moderated bool       `json:"moderated"`
	EmojiId   *Snowflake `json:"emoji_id,omitempty"`
	EmojiName *string    `json:"emoji_name,omitempty"`
}

type Team added in v0.1.4

type Team struct {
	Icon        string       `json:"icon"`
	Id          Snowflake    `json:"id"`
	Members     []TeamMember `json:"members"`
	Name        string       `json:"name"`
	OwnerUserId Snowflake    `json:"owner_user_id"`
}

type TeamMember added in v0.1.4

type TeamMember struct {
	MembershipState int       `json:"membership_state"`
	Permissions     []string  `json:"permissions"`
	TeamId          Snowflake `json:"team_id"`
	User            *User     `json:"user"`
}

type ThreadMember added in v0.1.9

type ThreadMember struct {
	Id            *Snowflake `json:"id,omitempty"`
	UserId        *Snowflake `json:"user_id,omitempty"`
	JoinTimestamp time.Time  `json:"join_timestamp"`
	Flags         int        `json:"flags"`
	Member        *Member    `json:"member,omitempty"`
}

type ThreadMetadata added in v0.1.9

type ThreadMetadata struct {
	Archived            bool       `json:"archived"`
	AutoArchiveDuration int        `json:"auto_archive_duration"`
	ArchiveTimestamp    time.Time  `json:"archive_timestamp"`
	Locked              bool       `json:"locked"`
	Invitable           *bool      `json:"invitable,omitempty"`
	CreateTimestamp     *time.Time `json:"create_timestamp,omitempty"`
}

type User

type User struct {
	Id            Snowflake `json:"id"`
	Username      string    `json:"username"`
	Discriminator string    `json:"discriminator"`
	Avatar        *string   `json:"avatar,omitempty"`
	Bot           *bool     `json:"bot,omitempty"`
	System        *bool     `json:"system,omitempty"`
	MfaEnabled    *bool     `json:"mfa_enabled,omitempty"`
	Banner        *string   `json:"banner,omitempty"`
	AccentColor   *uint32   `json:"accent_color,omitempty"`
	Locale        *string   `json:"locale,omitempty"`
	Verified      *bool     `json:"verified,omitempty"`
	Email         *string   `json:"email,omitempty"`
	Flags         *uint32   `json:"flags,omitempty"`
	PremiumType   *uint8    `json:"premium_type,omitempty"`
	PublicFlags   *uint32   `json:"public_flags,omitempty"`
}

Jump to

Keyboard shortcuts

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