discord

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetHttpClient added in v0.5.6

func SetHttpClient(newClient http.Client)

Types

type ActionRow added in v0.5.0

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

func (ActionRow) MarshalJSON added in v0.5.0

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

func (*ActionRow) Type added in v0.5.0

func (*ActionRow) UnmarshalDynamoDBAttributeValue added in v0.5.4

func (a *ActionRow) UnmarshalDynamoDBAttributeValue(value *dynamodb.AttributeValue) (err error)

func (*ActionRow) UnmarshalJSON added in v0.5.0

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

func (*ActionRow) Verify added in v0.5.0

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

func (allowedMentions AllowedMentions) Verify() error

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 ApplicationCommandData added in v0.5.0

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

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

type ApplicationCommandOption added in v0.5.0

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

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

type AutocompleteCallbackData added in v0.5.0

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

type Button added in v0.5.0

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

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

func (*Button) Type added in v0.5.0

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

func (*Button) Verify added in v0.5.0

func (button *Button) Verify() error

type Channel added in v0.1.9

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

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

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

func (Emoji) String added in v0.6.3

func (e Emoji) String() string

type ErrComponentMissingProperty added in v0.5.0

type ErrComponentMissingProperty struct {
	Component    MessageComponent
	PropertyName string
}

func (ErrComponentMissingProperty) Error added in v0.5.0

type ErrComponentMustHaveCustomId added in v0.5.0

type ErrComponentMustHaveCustomId struct {
	Component MessageComponent
}

func (ErrComponentMustHaveCustomId) Error added in v0.5.0

type ErrComponentMustHaveStyle added in v0.5.0

type ErrComponentMustHaveStyle struct {
	Component MessageComponent
}

func (ErrComponentMustHaveStyle) Error added in v0.5.0

type ErrInvalidParseGroup added in v0.5.0

type ErrInvalidParseGroup struct {
	InvalidGroup  allowed_mention_type.AllowedMentionType
	MentionObject AllowedMentions
}

func (ErrInvalidParseGroup) Error added in v0.5.0

func (e ErrInvalidParseGroup) Error() string

type ErrInvalidPropertyLength added in v0.5.0

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

func (ErrInvalidPropertyLength) Error added in v0.5.0

func (e ErrInvalidPropertyLength) Error() string

type ErrLinkButtonCannotHaveCustomId added in v0.5.0

type ErrLinkButtonCannotHaveCustomId struct {
	Component *Button
}

func (ErrLinkButtonCannotHaveCustomId) Error added in v0.5.0

type ErrLinkButtonMustHaveUrl added in v0.5.0

type ErrLinkButtonMustHaveUrl struct {
	Component *Button
}

func (ErrLinkButtonMustHaveUrl) Error added in v0.5.0

func (e ErrLinkButtonMustHaveUrl) Error() string

type ErrNestedActionRow added in v0.5.0

type ErrNestedActionRow struct {
	Components []MessageComponent
}

func (ErrNestedActionRow) Error added in v0.5.0

func (e ErrNestedActionRow) Error() string

type ErrNonLinkButtonCannotHaveUrl added in v0.5.0

type ErrNonLinkButtonCannotHaveUrl struct {
	Component *Button
}

func (ErrNonLinkButtonCannotHaveUrl) Error added in v0.5.0

type ErrNonStringSelectMenuCannotHaveOptions added in v0.5.0

type ErrNonStringSelectMenuCannotHaveOptions struct {
	Component *SelectMenu
}

func (ErrNonStringSelectMenuCannotHaveOptions) Error added in v0.5.0

type ErrSelectOptionMustHaveLabel added in v0.5.0

type ErrSelectOptionMustHaveLabel struct {
	Option SelectOption
}

func (ErrSelectOptionMustHaveLabel) Error added in v0.5.0

type ErrSelectOptionMustHaveValue added in v0.5.0

type ErrSelectOptionMustHaveValue struct {
	Option SelectOption
}

func (ErrSelectOptionMustHaveValue) Error added in v0.5.0

type ErrStringSelectMenuMustHaveOptions added in v0.5.0

type ErrStringSelectMenuMustHaveOptions struct {
	Component *SelectMenu
}

func (ErrStringSelectMenuMustHaveOptions) Error added in v0.5.0

type ErrTooManyComponents added in v0.5.0

type ErrTooManyComponents struct {
	Components []MessageComponent
}

func (ErrTooManyComponents) Error added in v0.5.0

func (e ErrTooManyComponents) Error() string

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 Interaction added in v0.5.0

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

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

func (*Interaction) CreateResponse added in v0.5.0

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

func (*Interaction) CreateResponseWithContext added in v0.6.1

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

func (*Interaction) DeferResponse added in v0.5.0

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

func (*Interaction) DeleteResponse added in v0.5.0

func (interaction *Interaction) DeleteResponse() error

func (*Interaction) EditResponse added in v0.5.0

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

func (*Interaction) GetResponse added in v0.5.0

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

func (*Interaction) GetWebhook added in v0.5.0

func (interaction *Interaction) GetWebhook() *Webhook

func (*Interaction) IsPing added in v0.5.0

func (interaction *Interaction) IsPing() bool

func (*Interaction) UnmarshalJSON added in v0.5.0

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

type InteractionCallbackData added in v0.5.0

type InteractionCallbackData interface {
}

type InteractionData added in v0.5.0

type InteractionData interface {
}

type InteractionResponse added in v0.5.0

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

func CreateDeferEditResponse added in v0.5.0

func CreateDeferEditResponse() InteractionResponse

func CreateDeferMessageResponse added in v0.5.0

func CreateDeferMessageResponse() InteractionResponse

func CreatePongResponse added in v0.5.0

func CreatePongResponse() InteractionResponse

func (InteractionResponse) ToAPIGatewayResponse added in v0.5.0

func (ir InteractionResponse) ToAPIGatewayResponse() events.APIGatewayProxyResponse

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                 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) UnmarshalDynamoDBAttributeValue added in v0.5.4

func (m *Message) UnmarshalDynamoDBAttributeValue(value *dynamodb.AttributeValue) (err error)

func (*Message) UnmarshalJSON added in v0.5.3

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

type MessageActivity added in v0.1.4

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

type MessageCallbackData added in v0.5.0

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

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

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

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

func (MessageComponentWrapper) MarshalJSON added in v0.5.0

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

func (*MessageComponentWrapper) UnmarshalDynamoDBAttributeValue added in v0.5.4

func (m *MessageComponentWrapper) UnmarshalDynamoDBAttributeValue(value *dynamodb.AttributeValue) (err error)

func (*MessageComponentWrapper) UnmarshalJSON added in v0.5.0

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

type MessageInteraction added in v0.4.4

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 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 ModalCallback added in v0.5.0

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

type ModalSubmitData added in v0.5.0

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

func (ModalSubmitData) UnmarshalJSON added in v0.5.0

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

type Overwrite added in v0.1.9

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 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 ResponseEditData added in v0.5.0

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

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

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

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

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

func (*SelectMenu) Verify added in v0.5.0

func (selectMenu *SelectMenu) Verify() error

type SelectOption added in v0.5.0

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

func (selectOption SelectOption) Verify() error

type Snowflake

type Snowflake uint64

func GetSnowflake

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

func SnowflakeFromTime added in v0.6.1

func SnowflakeFromTime(t time.Time) Snowflake

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

func (*Snowflake) UnmarshalText added in v0.5.9

func (i *Snowflake) UnmarshalText(text []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 StickerItem added in v0.5.0

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

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 TextInput added in v0.5.0

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

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

func (*TextInput) Type added in v0.5.0

func (*TextInput) Verify added in v0.5.0

func (t *TextInput) Verify() error

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 Webhook added in v0.5.0

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

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

func (*Webhook) DeleteMessage added in v0.5.0

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

func (*Webhook) DeleteMessageWithContext added in v0.6.1

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

func (*Webhook) EditMessage added in v0.5.0

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

func (*Webhook) EditMessageWithContext added in v0.6.1

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

func (*Webhook) GetMessage added in v0.5.0

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

func (*Webhook) GetMessageWithContext added in v0.6.1

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

func (*Webhook) GetUrl added in v0.5.0

func (hook *Webhook) GetUrl() string

func (*Webhook) Send added in v0.5.0

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

func (*Webhook) SendWithContext added in v0.6.1

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

type WebhookGetMessageRequest added in v0.5.0

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

type WebhookMessageResponse struct {
}

type WebhookRequest added in v0.5.0

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 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