common

package
v0.0.0-...-9e185e6 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DiscordAPIv8URL = "discord.com/api/v8"

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscordAllowedMention

type DiscordAllowedMention struct {
	// of allowed mention types	An array of allowed mention types to parse from the content.
	Parse []string `json:"parse,omitempty"`
	// of snowflakes	Array of role_ids to mention (Max size of 100)
	Roles []string `json:"roles,omitempty"`
	// of snowflakes	Array of user_ids to mention (Max size of 100)
	Users []string `json:"users,omitempty"`
	// For replies, whether to mention the author of the message being replied to (default false)
	RepliedUser bool `json:"replied_user,omitempty"`
}

type DiscordApplicationCommand

type DiscordApplicationCommand struct {
	//	snowflake	unique id of the command
	ID string `json:"id,omitempty"`
	// snowflake	unique id of the parent application
	ApplicationID string `json:"application_id,omitempty"`
	//	1-32 lowercase character name matching ^[\w-]{1,32}$
	Name string `json:"name"`
	//1-100 character description
	Description       string                             `json:"description"`
	Options           []*DiscordApplicationCommandOption `json:"options,omitempty"`
	DefaultPermission bool                               `json:"default_permission,omitempty"`
}

type DiscordApplicationCommandInteractionDataOption

type DiscordApplicationCommandInteractionDataOption struct {
	// the name of the parameter
	Name string `json:"name"`
	// value of ApplicationCommandOptionType
	Type DiscordApplicationCommandOptionType `json:"type"`
	// the value of the pair
	Value DiscordOptionType `json:"value"`
	// of ApplicationCommandInteractionDataOption	present if this option is a group or subcommand
	Options []DiscordApplicationCommandInteractionDataOption `json:"options,omitempty"`
}

DiscordApplicationCommandInteractionDataOption

type DiscordApplicationCommandInteractionDataResolved

type DiscordApplicationCommandInteractionDataResolved struct {
	//  ID: User	the IDs and User objects
	Users string `json:"users"`
	//  ID: Member	the IDs and partial Member objects
	Members string `json:"members"`
	//  ID: Role	the IDs and Role objects
	Roles string `json:"roles"`
	//  ID: Channel	the IDs and partial Channel objects
	Channels string `json:"channels"`
}

type DiscordApplicationCommandOption

type DiscordApplicationCommandOption struct {
	// value of ApplicationCommandOptionType
	Type DiscordApplicationCommandOptionType `json:"type"`
	//	1-32 lowercase character name matching ^[\w-]{1,32}$
	Name string `json:"name"`
	//	1-100 character description
	Description string `json:"description"`
	//	boolean	if the parameter is required or optional--default false
	Required bool `json:"required"`
	//	array of ApplicationCommandOptionChoice	choices for string and int types for the user to pick from
	Choices []*DiscordApplicationCommandOptionChoice `json:"choices,omitempty"`
	//	array of ApplicationCommandOption	if the option is a subcommand or subcommand group type, this nested options will be the parameters
	Options []*DiscordApplicationCommandOption `json:"options,omitempty"`
}

type DiscordApplicationCommandOptionChoice

type DiscordApplicationCommandOptionChoice struct {
	// 1-100 character choice name
	Name string `json:"name"`
	// value of the choice, up to 100 characters if string
	Value string `json:"value"`
}

type DiscordApplicationCommandOptionType

type DiscordApplicationCommandOptionType int
const (
	DiscordApplicationCommandOptionTypeSubCommand      DiscordApplicationCommandOptionType = 1
	DiscordApplicationCommandOptionTypeSubCommandGroup DiscordApplicationCommandOptionType = 2
	DiscordApplicationCommandOptionTypeString          DiscordApplicationCommandOptionType = 3
	DiscordApplicationCommandOptionTypeInteger         DiscordApplicationCommandOptionType = 4
	DiscordApplicationCommandOptionTypeBoolean         DiscordApplicationCommandOptionType = 5
	DiscordApplicationCommandOptionTypeUser            DiscordApplicationCommandOptionType = 6
	DiscordApplicationCommandOptionTypeChannel         DiscordApplicationCommandOptionType = 7
	DiscordApplicationCommandOptionTypeRole            DiscordApplicationCommandOptionType = 8
	DiscordApplicationCommandOptionTypeMentionable     DiscordApplicationCommandOptionType = 9
)

type DiscordAttachment

type DiscordAttachment struct {
	// attachment id
	ID string `json:"id"`
	// name of file attached
	Filename string `json:"filename"`
	// the attachment's media type
	ContentType string `json:"content_type,omitempty"`
	// size of file in bytes
	Size int `json:"size"`
	// source url of file
	URL string `json:"url"`
	// a proxied url of file
	ProxyURL string `json:"proxy_url"`
	// height of file (if image)
	Height int `json:"height,omitempty"`
	// width of file (if image)
	Width int `json:"width,omitempty"`
}

type DiscordAuthor

type DiscordAuthor struct {
	// name of author
	Name string `json:"name"`
	// url of author
	URL string `json:"url"`
	// url of author icon (only supports http(s) and attachments)
	IconURL string `json:"icon_url"`
	// a proxied url of author icon
	ProxyIconURL string `json:"proxy_icon_url"`
}

type DiscordEditWebhookMessage

type DiscordEditWebhookMessage struct {
	// the message contents (up to 2000 characters)
	Content string `json:"content,omitempty"`
	// of up to 10 embed objects	embedded rich content
	Embeds []*DiscordEmbed `json:"embeds,omitempty"`
	// contents	the contents of the file being sent/edited
	File string `json:"file,omitempty"`
	// JSON encoded body of non-file params (multipart/form-data only)
	PayloadJSON string `json:"payload_json,omitempty"`
	// mention object	allowed mentions for the message
	AllowedMentions *DiscordAllowedMention `json:"allowed_mentions,omitempty"`
	// of attachment objects	attached files to keep
	Attachments *DiscordAttachment `json:"attachments,omitempty"`
}

DiscordEditWebhookMessage is the type represented in https://discord.com/developers/docs/resources/webhook#edit-webhook-message

type DiscordEmbed

type DiscordEmbed struct {
	// title of embed
	Title string `json:"title"`
	// type of embed (always "rich" for webhook embeds)
	Type string `json:"type"`
	// description of embed
	Description string `json:"description"`
	// url of embed
	URL string `json:"url"`
	// timestamp	timestamp of embed content
	Timestamp time.Time `json:"timestamp"`
	// color code of the embed
	Color int `json:"color"`
	// footer object	footer information
	Footer *DiscordFooter `json:"footer,omitempty"`
	// image object	image information
	Image *DiscordImage `json:"image,omitempty"`
	// thumbnail object	thumbnail information
	Thumbnail *DiscordImage `json:"thumbnail,omitempty"`
	// video object	video information
	Video *DiscordImage `json:"video,omitempty"`
	// provider object	provider information
	Provider *DiscordProvider `json:"provider,omitempty"`
	// author object	author information
	Author *DiscordAuthor `json:"author,omitempty"`
	// of embed field objects	fields information
	Fields []DiscordEmbedField `json:"fields,omitempty"`
}

type DiscordEmbedField

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

type DiscordFooter

type DiscordFooter struct {
	// footer text
	Text string `json:"text"`
	// url of footer icon (only supports http(s) and attachments)
	IconURL string `json:"icon_url"`
	// a proxied url of footer icon
	ProxyIconURL string `json:"proxy_icon_url"`
}

type DiscordImage

type DiscordImage struct {
	// source url of image (only supports http(s) and attachments)
	URL string `json:"url"`
	// a proxied url of the image
	ProxyURL string `json:"proxy_url"`
	// height of image
	Height int `json:"height"`
	// width of image
	Width int `json:"width"`
}

type DiscordInteraction

type DiscordInteraction struct {
	// 	id of the interaction
	ID string `json:"id"`
	// 	id of the application this interaction is for
	ApplicationID string `json:"application_id"`
	// 	the type of interaction
	Type DiscordInteractionType `json:"type"`
	// 	the command data payload
	Data struct {
		// 	the ID of the invoked command
		ID string `json:"id"`
		// 	the name of the invoked command
		Name string `json:"name"`
		// 	converted users + roles + channels
		Resolved *DiscordApplicationCommandInteractionDataResolved `json:"resolved,omitempty"`
		//  of ApplicationCommandInteractionDataOption	the params + values from the user
		Options []*DiscordApplicationCommandInteractionDataOption `json:"options,omitempty"`
	} `json:"data"`
	// 	the guild it was sent from
	GuildID string `json:"guild_id"`
	// 	the channel it was sent from
	ChannelID string `json:"channel_id"`
	//  member object	guild member data for the invoking user, including permissions
	Member *DiscordMember `json:"member,omitempty"`
	//  object	user object for the invoking user, if invoked in a DM
	User discordgo.User `json:"user"`
	// 	a continuation token for responding to the interaction
	Token string `json:"token"`
	// 	read-only property, always 1
	Version int `json:"version"`
}

type DiscordInteractionApplicationCommandCallbackData

type DiscordInteractionApplicationCommandCallbackData struct {
	//	is the response TTS
	TTS bool `json:"tts"`
	// message content
	Content string `json:"content"`
	// of embeds	supports up to 10 embeds
	Embeds []*DiscordEmbed `json:"embeds,omitempty"`
	// allowed mentions object
	AllowedMentions *DiscordAllowedMention `json:"allowed_mentions,omitempty"`
	// set to 64 to make your response ephemeral
	Flags int `json:"flags"`
}

type DiscordInteractionCallbackType

type DiscordInteractionCallbackType int
const (
	// DiscordInteractionCallbackTypePong ACK a Ping
	DiscordInteractionCallbackTypePong DiscordInteractionCallbackType = 1
	// DiscordInteractionCallbackTypeChannelMessageWithSource respond to an interaction with a message
	DiscordInteractionCallbackTypeChannelMessageWithSource DiscordInteractionCallbackType = 4
	// DiscordInteractionCallbackTypeDeferredChannelMessageWithSource ACK an interaction and edit a response later, the user sees a loading state
	DiscordInteractionCallbackTypeDeferredChannelMessageWithSource DiscordInteractionCallbackType = 5
)

type DiscordInteractionResponse

type DiscordInteractionResponse struct {
	// the type of response
	Type DiscordInteractionCallbackType `json:"type"`
	// 	an optional response message
	Data DiscordInteractionApplicationCommandCallbackData `json:"data"`
}

type DiscordInteractionType

type DiscordInteractionType int
const (
	DiscordInteractionTypePing               DiscordInteractionType = 1
	DiscordInteractionTypeApplicationCommand DiscordInteractionType = 2
)

type DiscordMember

type DiscordMember struct {
	//  object	the user this guild member represents
	User discordgo.User `json:"user"`
	// 	this users guild nickname
	Nick string `json:"nick"`
	//  of snowflakes	array of role object ids
	Roles []string `json:"roles"`
	//  timestamp	when the user joined the guild
	JoinedAt time.Time `json:"joined_at"`
	//  timestamp	when the user started boosting the guild
	PremiumSince time.Time `json:"premium_since"`
	// 	whether the user is deafened in voice channels
	Deaf bool `json:"deaf"`
	// 	whether the user is muted in voice channels
	Mute bool `json:"mute"`
	// 	whether the user has not yet passed the guild's Membership Screening requirements
	Pending bool `json:"pending"`
	// 	total permissions of the member in the channel, including overrides, returned when in the interaction object
	Permissions string `json:"permissions"`
}

type DiscordOptionType

type DiscordOptionType struct {
	IntValue    *int
	StringValue *string
	BoolValue   *bool
}

func (DiscordOptionType) MarshalJSON

func (d DiscordOptionType) MarshalJSON() ([]byte, error)

func (*DiscordOptionType) UnmarshalJSON

func (d *DiscordOptionType) UnmarshalJSON(bytes []byte) error

type DiscordProvider

type DiscordProvider struct {
	// name of provider
	Name string `json:"name"`
	// url of provider
	URL string `json:"url"`
}

Jump to

Keyboard shortcuts

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