discord

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: GPL-3.0 Imports: 4 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"`
}

func (*Embed) Verify added in v0.2.6

func (embed *Embed) Verify() error

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 EmbedError added in v0.2.6

type EmbedError struct {
	Embed   *Embed
	Message string
}

func (EmbedError) Error added in v0.2.6

func (e EmbedError) Error() string

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 Guild added in v0.2.5

type Guild struct {
	Id                          Snowflake      `json:"id"`
	Name                        string         `json:"name"`
	Icon                        *string        `json:"icon,omitempty"`
	IconHash                    *string        `json:"icon_hash,omitempty"`
	Splash                      *string        `json:"splash,omitempty"`
	DiscoverySplash             *string        `json:"discovery_splash,omitempty"`
	Owner                       *bool          `json:"owner,omitempty"`
	OwnerId                     Snowflake      `json:"owner_id"`
	Permissions                 *Permissions   `json:"permissions,omitempty"`
	Region                      *string        `json:"region,omitempty"`
	AfkChannelId                *Snowflake     `json:"afk_channel_id,omitempty"`
	AfkTimeout                  int            `json:"afk_timeout"`
	WidgetEnabled               *bool          `json:"widget_enabled,omitempty"`
	WidgetChannelId             *Snowflake     `json:"widget_channel_id,omitempty"`
	VerificationLevel           int            `json:"verification_level"`
	DefaultMessageNotifications int            `json:"default_message_notifications"`
	ExplicitContentFilter       int            `json:"explicit_content_filter"`
	Roles                       []Role         `json:"roles"`
	Emojis                      []Emoji        `json:"emojis"`
	Features                    []string       `json:"features"`
	MfaLevel                    int            `json:"mfa_level"`
	ApplicationId               *Snowflake     `json:"application_id,omitempty"`
	SystemChannelId             *Snowflake     `json:"system_channel_id,omitempty"`
	SystemChannelFlags          int            `json:"system_channel_flags"`
	RulesChannelId              *Snowflake     `json:"rules_channel_id,omitempty"`
	MaxPresences                *int           `json:"max_presences,omitempty"`
	MaxMembers                  int            `json:"max_members"`
	VanityURLCode               *string        `json:"vanity_url_code,omitempty"`
	Description                 *string        `json:"description,omitempty"`
	Banner                      *string        `json:"banner,omitempty"`
	PremiumTier                 int            `json:"premium_tier"`
	PremiumSubscriptionCount    *int           `json:"premium_subscription_count,omitempty"`
	PreferredLocale             string         `json:"preferred_locale"`
	PublicUpdatesChannelId      *Snowflake     `json:"public_updates_channel_id,omitempty"`
	MaxVideoChannelUsers        *int           `json:"max_video_channel_users,omitempty"`
	MaxStageVideoChannelUsers   *int           `json:"max_stage_video_channel_users,omitempty"`
	ApproximateMemberCount      *int           `json:"approximate_member_count,omitempty"`
	ApproximatePresenceCount    *int           `json:"approximate_presence_count,omitempty"`
	WelcomeScreen               *WelcomeScreen `json:"welcome_screen,omitempty"`
	NsfwLevel                   int            `json:"nsfw_level"`
	Stickers                    []Sticker      `json:"stickers"`
	PremiumProgressBarEnabled   *bool          `json:"premium_progress_bar_enabled,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 MessageReference added in v0.2.1

type MessageReference struct {
	MessageId Snowflake `json:"message_id,omitempty"`
	// Optional when sending a reply
	ChannelId       Snowflake `json:"channel_id,omitempty"`
	GuildId         Snowflake `json:"guild_id,omitempty"`
	FailIfNotExists bool      `json:"fail_if_not_exists,omitempty"`
}

type MessageType added in v0.1.4

type MessageType uint8

type Overwrite added in v0.1.9

type Overwrite struct {
	// Role or User ID
	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) String added in v0.2.0

func (i Snowflake) String() string

func (*Snowflake) UnmarshalJSON

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

type Sticker added in v0.2.5

type Sticker struct {
	Id          Snowflake  `json:"id"`
	PackId      *Snowflake `json:"pack_id,omitempty"`
	Name        string     `json:"name"`
	Description *string    `json:"description,omitempty"`
	Tags        *string    `json:"tags,omitempty"`
	Asset       *string    `json:"asset,omitempty"`
	Type        int        `json:"type"`
	FormatType  int        `json:"format_type"`
	Available   *bool      `json:"available,omitempty"`
	GuildId     *Snowflake `json:"guild_id,omitempty"`
	User        *User      `json:"user,omitempty"`
	SortValue   *int       `json:"sort_value,omitempty"`
}

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 {
	ThreadId      *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"`
}

type WelcomeScreen added in v0.2.5

type WelcomeScreen struct {
	Description     *string                `json:"description,omitempty"`
	WelcomeChannels []WelcomeScreenChannel `json:"welcome_channels"`
}

type WelcomeScreenChannel added in v0.2.5

type WelcomeScreenChannel struct {
	ChannelId   Snowflake  `json:"channel_id"`
	Description string     `json:"description"`
	EmojiId     *Snowflake `json:"emoji_id,omitempty"`
	EmojiName   *string    `json:"emoji_name,omitempty"`
}

Jump to

Keyboard shortcuts

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