discord

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetHttpClient

func SetHttpClient(newClient http.Client)

Types

type ActionRow

type ActionRow struct {
	RowType    component_type.ComponentType `json:"type"`
	Components []MessageComponent           `json:"components"`
}

func (ActionRow) MarshalJSON

func (a ActionRow) MarshalJSON() ([]byte, error)

func (*ActionRow) Type

func (*ActionRow) UnmarshalJSON

func (a *ActionRow) UnmarshalJSON(data []byte) error

func (*ActionRow) Verify

func (a *ActionRow) Verify() error

type AllowedMentions

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

func (AllowedMentions) Verify

func (allowedMentions AllowedMentions) Verify() error

type Application

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 ApplicationCommandData

type ApplicationCommandData struct {
	Id       Snowflake                           `json:"id"`
	Name     string                              `json:"name"`
	Type     command_type.ApplicationCommandType `json:"type"`
	Resolved *ResolvedData                       `json:"resolved,omitempty"`
	Options  []ApplicationCommandOption          `json:"options,omitempty"`
	GuildId  *Snowflake                          `json:"guild_id,omitempty"`
	TargetId *Snowflake                          `json:"target_id,omitempty"`
	// contains filtered or unexported fields
}

func (*ApplicationCommandData) GetOption

func (commandData *ApplicationCommandData) GetOption(optionName string) *ApplicationCommandOption

type ApplicationCommandOption

type ApplicationCommandOption struct {
	Name    string                                `json:"name"`
	Type    command_option_type.CommandOptionType `json:"type"`
	Value   interface{}                           `json:"value,omitempty"`
	Options []ApplicationCommandOption            `json:"options,omitempty"`
	Focused bool                                  `json:"focused,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 AutoCompleteChoice

type AutoCompleteChoice struct {
	Name              string             `json:"name"`
	NameLocalizations *map[string]string `json:"name_localizations,omitempty"`
	Value             interface{}        `json:"value"`
}

type AutocompleteCallbackData

type AutocompleteCallbackData struct {
	Choices []AutoCompleteChoice `json:"choices"`
}

type Button

type Button struct {
	Style      button_style.ButtonStyle     `json:"style"`
	Label      *string                      `json:"label,omitempty"`
	Emoji      *Emoji                       `json:"emoji,omitempty"`
	CustomId   *string                      `json:"custom_id,omitempty"`
	Url        *string                      `json:"url,omitempty"`
	Disabled   *bool                        `json:"disabled,omitempty"`
	ButtonType component_type.ComponentType `json:"type"`
}

func (Button) MarshalJSON

func (button Button) MarshalJSON() ([]byte, error)

func (*Button) Type

func (button *Button) Type() component_type.ComponentType

func (*Button) Verify

func (button *Button) Verify() error

type Channel

type Channel struct {
	Id                            Snowflake                `json:"id"`
	Type                          channel_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

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

type DefaultReaction

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

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

type EmbedError struct {
	Embed   *Embed
	Message string
}

func (EmbedError) Error

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

func (Emoji) String

func (e Emoji) String() string

type ErrComponentMissingProperty

type ErrComponentMissingProperty struct {
	Component    MessageComponent
	PropertyName string
}

func (ErrComponentMissingProperty) Error

type ErrComponentMustHaveCustomId

type ErrComponentMustHaveCustomId struct {
	Component MessageComponent
}

func (ErrComponentMustHaveCustomId) Error

type ErrComponentMustHaveStyle

type ErrComponentMustHaveStyle struct {
	Component MessageComponent
}

func (ErrComponentMustHaveStyle) Error

type ErrInvalidParseGroup

type ErrInvalidParseGroup struct {
	InvalidGroup  allowed_mention_type.AllowedMentionType
	MentionObject AllowedMentions
}

func (ErrInvalidParseGroup) Error

func (e ErrInvalidParseGroup) Error() string

type ErrInvalidPropertyLength

type ErrInvalidPropertyLength struct {
	Component      interface{}
	PropertyName   string
	MaxLength      int
	MinLength      int
	PropertyLength int
	PropertyValue  interface{}
}

func (ErrInvalidPropertyLength) Error

func (e ErrInvalidPropertyLength) Error() string

type ErrLinkButtonCannotHaveCustomId

type ErrLinkButtonCannotHaveCustomId struct {
	Component *Button
}

func (ErrLinkButtonCannotHaveCustomId) Error

type ErrLinkButtonMustHaveUrl

type ErrLinkButtonMustHaveUrl struct {
	Component *Button
}

func (ErrLinkButtonMustHaveUrl) Error

func (e ErrLinkButtonMustHaveUrl) Error() string

type ErrNestedActionRow

type ErrNestedActionRow struct {
	Components []MessageComponent
}

func (ErrNestedActionRow) Error

func (e ErrNestedActionRow) Error() string

type ErrNonLinkButtonCannotHaveUrl

type ErrNonLinkButtonCannotHaveUrl struct {
	Component *Button
}

func (ErrNonLinkButtonCannotHaveUrl) Error

type ErrNonStringSelectMenuCannotHaveOptions

type ErrNonStringSelectMenuCannotHaveOptions struct {
	Component *SelectMenu
}

func (ErrNonStringSelectMenuCannotHaveOptions) Error

type ErrSelectOptionMustHaveLabel

type ErrSelectOptionMustHaveLabel struct {
	Option SelectOption
}

func (ErrSelectOptionMustHaveLabel) Error

type ErrSelectOptionMustHaveValue

type ErrSelectOptionMustHaveValue struct {
	Option SelectOption
}

func (ErrSelectOptionMustHaveValue) Error

type ErrStringSelectMenuMustHaveOptions

type ErrStringSelectMenuMustHaveOptions struct {
	Component *SelectMenu
}

func (ErrStringSelectMenuMustHaveOptions) Error

type ErrTooManyComponents

type ErrTooManyComponents struct {
	Components []MessageComponent
}

func (ErrTooManyComponents) Error

func (e ErrTooManyComponents) Error() string

type Guild

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 HTTPResponse added in v1.0.1

type HTTPResponse struct {
	StatusCode uint
	Body       string
	Headers    map[string]string
}

func (HTTPResponse) WriteResponse added in v1.0.2

func (res HTTPResponse) WriteResponse(w http.ResponseWriter)

type InstallParams

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

type Interaction

type Interaction struct {
	Id             Snowflake                        `json:"id"`
	ApplicationId  Snowflake                        `json:"application_id"`
	Type           interaction_type.InteractionType `json:"type"`
	DataInternal   *json.RawMessage                 `json:"data,omitempty"`
	Data           InteractionData                  `json:"-"`
	GuildId        *Snowflake                       `json:"guild_id,omitempty"`
	Channel        *Channel                         `json:"channel,omitempty"`
	ChannelId      *Snowflake                       `json:"channel_id,omitempty"`
	Member         *Member                          `json:"member,omitempty"`
	User           *User                            `json:"user,omitempty"`
	Token          string                           `json:"token"`
	Version        int                              `json:"version"`
	Message        *Message                         `json:"message,omitempty"`
	AppPermissions *Permissions                     `json:"permissions,omitempty"`
	Locale         string                           `json:"locale"`
	GuildLocale    string                           `json:"guild_locale"`
	// contains filtered or unexported fields
}

func ParseInteraction

func ParseInteraction(data string) (interaction *Interaction, err error)

func (*Interaction) CreateResponse

func (interaction *Interaction) CreateResponse(response InteractionResponse) error

func (*Interaction) CreateResponseWithContext

func (interaction *Interaction) CreateResponseWithContext(ctx context.Context, response InteractionResponse) error

func (*Interaction) DeferResponse

func (interaction *Interaction) DeferResponse(isEphemeral bool) error

func (*Interaction) DeleteResponse

func (interaction *Interaction) DeleteResponse() error

func (*Interaction) EditResponse

func (interaction *Interaction) EditResponse(data ResponseEditData) error

func (*Interaction) GetResponse

func (interaction *Interaction) GetResponse() (*Message, error)

func (*Interaction) GetWebhook

func (interaction *Interaction) GetWebhook() *Webhook

func (*Interaction) IsPing

func (interaction *Interaction) IsPing() bool

func (*Interaction) UnmarshalJSON

func (interaction *Interaction) UnmarshalJSON(d []byte) error

type InteractionCallbackData

type InteractionCallbackData interface {
}

type InteractionData

type InteractionData interface {
}

type InteractionResponse

type InteractionResponse struct {
	Type interaction_callback_type.InteractionCallbackType `json:"type"`
	Data InteractionCallbackData                           `json:"data,omitempty"`
}

func CreateDeferEditResponse

func CreateDeferEditResponse() InteractionResponse

func CreateDeferMessageResponse

func CreateDeferMessageResponse() InteractionResponse

func CreatePongResponse

func CreatePongResponse() InteractionResponse

func (InteractionResponse) ToHttpResponse added in v1.0.1

func (ir InteractionResponse) ToHttpResponse() HTTPResponse

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

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                 message_type.MessageType `json:"type"`
	Activity             *MessageActivity         `json:"activity,omitempty"`
	Application          *Application             `json:"application,omitempty"`
	ApplicationId        *Snowflake               `json:"application_id,omitempty"`
	MessageReference     *MessageReference        `json:"message_reference,omitempty"`
	Flags                *int                     `json:"flags,omitempty"`
	ReferencedMessage    *Message                 `json:"referenced_message,omitempty"`
	Interaction          *MessageInteraction      `json:"interaction,omitempty"`
	Thread               *Channel                 `json:"thread,omitempty"`
	Components           []MessageComponent       `json:"components,omitempty"`
	StickerItems         []StickerItem            `json:"sticker_items,omitempty"`
	Position             *int                     `json:"position,omitempty"`
	RoleSubscriptionData *RoleSubscriptionData    `json:"role_subscription_data,omitempty"`
}

func (*Message) UnmarshalJSON

func (m *Message) UnmarshalJSON(data []byte) error

type MessageActivity

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

type MessageCallbackData

type MessageCallbackData struct {
	TTS             *bool              `json:"tts,omitempty"`
	Content         *string            `json:"content,omitempty"`
	Embeds          []Embed            `json:"embeds,omitempty"`
	AllowedMentions *AllowedMentions   `json:"allowed_mentions,omitempty"`
	Flags           *int               `json:"flags,omitempty"`
	Components      []MessageComponent `json:"components,omitempty"`
	Attachments     []Attachment       `json:"attachments,omitempty"`
}

type MessageComponent

type MessageComponent interface {
	Type() component_type.ComponentType
	Verify() error
}

MessageComponent can be made of any variables, so it's a map until we parse it into a specific component.

type MessageComponentData

type MessageComponentData struct {
	CustomId string                       `json:"custom_id"`
	Type     component_type.ComponentType `json:"component_type"`
	Values   []string                     `json:"values"`
	Resolved *ResolvedData                `json:"resolved,omitempty"`
}

type MessageComponentWrapper

type MessageComponentWrapper struct {
	// contains filtered or unexported fields
}

func (MessageComponentWrapper) MarshalJSON

func (m MessageComponentWrapper) MarshalJSON() ([]byte, error)

func (*MessageComponentWrapper) UnmarshalJSON

func (m *MessageComponentWrapper) UnmarshalJSON(data []byte) error

type MessageInteraction

type MessageInteraction struct {
	Id     Snowflake `json:"id"`
	Type   uint8     `json:"type"`
	Name   string    `json:"name"`
	User   User      `json:"user"`
	Member *Member   `json:"member"`
}

type MessageReference

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 ModalCallback

type ModalCallback struct {
	CustomId   string             `json:"custom_id"`
	Title      string             `json:"title"`
	Components []MessageComponent `json:"components"`
}

type ModalSubmitData

type ModalSubmitData struct {
	CustomId   string             `json:"custom_id"`
	Components []MessageComponent `json:"components"`
}

func (*ModalSubmitData) UnmarshalJSON

func (m *ModalSubmitData) UnmarshalJSON(data []byte) error

type Overwrite

type Overwrite struct {
	// Role or User ID
	Id    Snowflake   `json:"id"`
	Type  string      `json:"type"`
	Allow Permissions `json:"allow"`
	Deny  Permissions `json:"deny"`
}

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

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 ResponseEditData

type ResponseEditData struct {
	Content         *string            `json:"content,omitempty"`
	Embeds          []Embed            `json:"embeds,omitempty"`
	AllowedMentions *AllowedMentions   `json:"allowed_mentions"`
	Components      []MessageComponent `json:"components"`
}

func (ResponseEditData) Verify

func (data ResponseEditData) Verify() error

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 RoleSubscriptionData

type RoleSubscriptionData struct {
	RoleSubscriptionListingId Snowflake `json:"role_subscription_listing_id"`
	TierName                  string    `json:"tier_name"`
	TotalMonthsSubscribed     int       `json:"total_months_subscribed"`
	IsRenewal                 bool      `json:"is_renewal"`
}

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 SelectMenu

type SelectMenu struct {
	MenuType     component_type.ComponentType `json:"type"`
	CustomId     string                       `json:"custom_id"`
	Options      []SelectOption               `json:"options,omitempty"`
	ChannelTypes []channel_type.ChannelType   `json:"channel_types,omitempty"`
	Placeholder  *string                      `json:"placeholder,omitempty"`
	MinValues    *uint8                       `json:"min_values,omitempty"`
	MaxValues    *uint8                       `json:"max_values,omitempty"`
	Disabled     *bool                        `json:"disabled,omitempty"`
}

func (*SelectMenu) Type

func (selectMenu *SelectMenu) Type() component_type.ComponentType

func (*SelectMenu) Verify

func (selectMenu *SelectMenu) Verify() error

type SelectOption

type SelectOption struct {
	Label       string  `json:"label"`
	Value       string  `json:"value"`
	Description *string `json:"description,omitempty"`
	Emoji       *Emoji  `json:"emoji,omitempty"`
	Default     *bool   `json:"default,omitempty"`
}

func (SelectOption) Verify

func (selectOption SelectOption) Verify() error

type Snowflake

type Snowflake uint64

func GetSnowflake

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

func SnowflakeFromTime

func SnowflakeFromTime(t time.Time) Snowflake

func (Snowflake) MarshalJSON

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

func (*Snowflake) String

func (i *Snowflake) String() string

func (*Snowflake) UnmarshalJSON

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

func (*Snowflake) UnmarshalText

func (i *Snowflake) UnmarshalText(text []byte) error

type Sticker

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 StickerItem

type StickerItem struct {
	Id         Snowflake `json:"id"`
	Name       string    `json:"name"`
	FormatType int       `json:"format_type"`
}

type Tag

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

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

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

type TextInput

type TextInput struct {
	TextInputType component_type.ComponentType    `json:"type"`
	CustomId      string                          `json:"custom_id"`
	Style         text_input_style.TextInputStyle `json:"style"`
	Label         string                          `json:"label"`
	MinLength     int                             `json:"min_length"`
	MaxLength     int                             `json:"max_length"`
	Required      bool                            `json:"required"`
	Value         string                          `json:"value"`
	Placeholder   string                          `json:"placeholder"`
}

func (TextInput) MarshalJSON

func (t TextInput) MarshalJSON() ([]byte, error)

func (*TextInput) Type

func (*TextInput) Verify

func (t *TextInput) Verify() error

type ThreadMember

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

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 Webhook

type Webhook struct {
	Id            Snowflake  `json:"id"`
	Type          uint8      `json:"type"`
	GuildId       *Snowflake `json:"guild_id,omitempty"`
	ChannelId     *Snowflake `json:"channel_id,omitempty"`
	User          *User      `json:"user,omitempty"`
	Name          *string    `json:"name,omitempty"`
	Avatar        *string    `json:"avatar,omitempty"`
	Token         *string    `json:"token,omitempty"`
	ApplicationId *Snowflake `json:"application_id,omitempty"`
	SourceGuild   *Guild     `json:"source_guild,omitempty"`
	SourceChannel *Channel   `json:"source_channel,omitempty"`
	Url           *string    `json:"url,omitempty"`
}

func WebhookFromUrl

func WebhookFromUrl(url string) (webhook *Webhook, err error)

func (*Webhook) DeleteMessage

func (hook *Webhook) DeleteMessage(messageId string) error

func (*Webhook) DeleteMessageWithContext

func (hook *Webhook) DeleteMessageWithContext(ctx context.Context, messageId string) (err error)

func (*Webhook) EditMessage

func (hook *Webhook) EditMessage(messageId string, data ResponseEditData) error

func (*Webhook) EditMessageWithContext

func (hook *Webhook) EditMessageWithContext(ctx context.Context, messageId string, data ResponseEditData) error

func (*Webhook) GetMessage

func (hook *Webhook) GetMessage(req WebhookGetMessageRequest) (message *Message, err error)

func (*Webhook) GetMessageWithContext

func (hook *Webhook) GetMessageWithContext(ctx context.Context, req WebhookGetMessageRequest) (message *Message, err error)

func (*Webhook) GetUrl

func (hook *Webhook) GetUrl() string

func (*Webhook) Send

func (hook *Webhook) Send(req WebhookRequest) (returnedMessage *Message, err error)

func (*Webhook) SendWithContext

func (hook *Webhook) SendWithContext(ctx context.Context, req WebhookRequest) (returnedMessage *Message, err error)

type WebhookGetMessageRequest

type WebhookGetMessageRequest struct {
	// String so it can be "@original"
	MessageId string     `json:"-"` // Not sent in request body
	ThreadId  *Snowflake `json:"thread_id,omitempty"`
}

type WebhookMessageResponse

type WebhookMessageResponse struct {
}

type WebhookRequest

type WebhookRequest struct {
	Content         *string            `json:"content,omitempty"`
	Username        string             `json:"username,omitempty"`
	AvatarUrl       string             `json:"avatar_url,omitempty"`
	TTS             *bool              `json:"tts,omitempty"`
	Embeds          []Embed            `json:"embeds,omitempty"`
	AllowedMentions *AllowedMentions   `json:"allowed_mentions,omitempty"`
	Flags           *int               `json:"flags,omitempty"`
	Components      []MessageComponent `json:"components,omitempty"`
	Attachments     []Attachment       `json:"attachments,omitempty"`
	ThreadName      string             `json:"thread_name,omitempty"`
}

type WelcomeScreen

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

type WelcomeScreenChannel

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