api

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandPermissionTypeRole = iota + 1
	CommandPermissionTypeUser
)

types of CommandPermissionType

Variables

View Source
var (
	ErrNoGateway     = errors.New("no gateway initialized")
	ErrNoGatewayConn = errors.New("no active gateway connection found")
)

errors returned when no gateway or ws conn exists

View Source
var (
	ErrBadGateway                 = errors.New("bad gateway could not reach discord")
	ErrUnauthorized               = errors.New("not authorized for this endpoint")
	ErrBadRequest                 = errors.New("bad request please check your request")
	ErrRatelimited                = errors.New("too many requests")
	ErrTooMuchApplicationCommands = errors.New("you can provide a max of 100 application commands")
)

Errors when connecting to discord

View Source
var DefaultInteractionAllowedMentions = AllowedMentions{
	Parse:       []AllowedMentionType{AllowedMentionTypeUsers},
	Roles:       []Snowflake{},
	Users:       []Snowflake{},
	RepliedUser: false,
}

DefaultInteractionAllowedMentions gives you the default AllowedMentions for an Interaction

View Source
var DefaultMessageAllowedMentions = AllowedMentions{
	Parse:       []AllowedMentionType{AllowedMentionTypeUsers, AllowedMentionTypeRoles, AllowedMentionTypeEveryone},
	Roles:       []Snowflake{},
	Users:       []Snowflake{},
	RepliedUser: true,
}

DefaultMessageAllowedMentions gives you the default AllowedMentions for a Message

Functions

func GetOS

func GetOS() string

GetOS returns the simplified version of the operating system for sending to Discord in the IdentifyCommandDataProperties.OS payload

func Verify

func Verify(disgo Disgo, r *http.Request, key ed25519.PublicKey) bool

Verify implements the verification side of the discord interactions api signing algorithm, as documented here: https://discord.com/developers/docs/interactions/slash-commands#security-and-authorization Credit: https://github.com/bsdlp/discord-interactions-go/blob/main/interactions/verify.go

Types

type Activity

type Activity struct {
	Name          string              `json:"name"`
	Type          ActivityType        `json:"type"`
	URL           *string             `json:"url"`
	CreatedAt     time.Time           `json:"created_at"`
	Timestamps    *ActivityTimestamps `json:"timestamps,omitempty"`
	ApplicationID Snowflake           `json:"application_id,omitempty"`
	Details       *string             `json:"details,omitempty"`
	State         *string             `json:"state,omitempty"`
	Emoji         *ActivityEmoji      `json:"emoji,omitempty"`
	Party         *ActivityParty      `json:"party,omitempty"`
	Assets        *ActivityAssets     `json:"assets,omitempty"`
	Secrets       *ActivitySecrets    `json:"secrets,omitempty"`
	Instance      *bool               `json:"instance,omitempty"`
	Flags         int                 `json:"flags,omitempty"`
}

Activity represents the fields of a user's presence

type ActivityAssets

type ActivityAssets struct {
	LargeImage string `json:"large_image,omitempty"`
	LargeText  string `json:"large_text,omitempty"`
	SmallImage string `json:"small_image,omitempty"`
	SmallText  string `json:"small_text,omitempty"`
}

ActivityAssets are the images for the presence and hover texts

type ActivityEmoji

type ActivityEmoji struct {
	Name     string     `json:"name"`
	ID       *Snowflake `json:"id,omitempty"`
	Animated *bool      `json:"animated,omitempty"`
}

ActivityEmoji is an Emoji object for an Activity

type ActivityParty

type ActivityParty struct {
	ID   Snowflake `json:"id,omitempty"`
	Size []int     `json:"size,omitempty"`
}

ActivityParty is information about the party of the player

type ActivitySecrets

type ActivitySecrets struct {
	Join     string `json:"join,omitempty"`
	Spectate string `json:"spectate,omitempty"`
	Match    string `json:"match,omitempty"`
}

ActivitySecrets contain secrets for Rich Presence joining and spectating

type ActivityTimestamps

type ActivityTimestamps struct {
	Start *time.Time `json:"start,omitempty"`
	End   *time.Time `json:"end,omitempty"`
}

ActivityTimestamps represents when a user started and ended their activity

type ActivityType

type ActivityType int

ActivityType represents the status of a user, one of Game, Streaming, Listening, Watching, Custom or Competing

const (
	Game ActivityType = iota
	Streaming
	Listening
	Watching
	Custom
	Competing
)

Constants for activities

type AddGuildMemberData

type AddGuildMemberData struct {
	AccessToken string      `json:"access_token"`
	Nick        *string     `json:"nick,omitempty"`
	Roles       []Snowflake `json:"roles,omitempty"`
	Mute        *bool       `json:"mute,omitempty"`
	Deaf        *bool       `json:"deaf,omitempty"`
}

AddGuildMemberData is used to add a member via the oauth2 access token to a guild

type AllowedMentionType

type AllowedMentionType string

AllowedMentionType ?

const (
	AllowedMentionTypeRoles    AllowedMentionType = "roles"
	AllowedMentionTypeUsers    AllowedMentionType = "users"
	AllowedMentionTypeEveryone AllowedMentionType = "everyone"
)

All AllowedMentionType(s)

type AllowedMentions

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

AllowedMentions are used for avoiding mentioning users in Message and Interaction

type AudioController added in v0.2.0

type AudioController interface {
	Disgo() Disgo
	Connect(guildID Snowflake, channelID Snowflake) error
	Disconnect(guildID Snowflake) error
}

AudioController lets you Connect / Disconnect from a VoiceChannel

type Bit

type Bit interface {
	Add(bits ...Bit) Bit
	Remove(bits ...Bit) Bit
	HasAll(bits ...Bit) bool
	Has(bit Bit) bool
	MissingAny(bits ...Bit) bool
	Missing(bit Bit) bool
}

Bit is a utility for interacting with bitfields

type Cache

type Cache interface {
	Disgo() Disgo
	Close()
	DoCleanup()
	CacheFlags() CacheFlags

	Command(commandID Snowflake) *Command
	GuildCommandCache(guildID Snowflake) map[Snowflake]*Command
	AllGuildCommandCache() map[Snowflake]map[Snowflake]*Command
	GlobalCommandCache() map[Snowflake]*Command
	CacheGlobalCommand(command *Command) *Command
	CacheGuildCommand(command *Command) *Command
	UncacheCommand(commandID Snowflake)

	User(Snowflake) *User
	UserByTag(string) *User
	UsersByName(string, bool) []*User
	Users() []*User
	UserCache() map[Snowflake]*User
	CacheUser(*User) *User
	UncacheUser(Snowflake)
	FindUser(func(*User) bool) *User
	FindUsers(func(*User) bool) []*User

	Guild(Snowflake) *Guild
	GuildsByName(string, bool) []*Guild
	Guilds() []*Guild
	GuildCache() map[Snowflake]*Guild
	CacheGuild(*Guild) *Guild
	UncacheGuild(Snowflake)

	Message(channelID Snowflake, messageID Snowflake) *Message
	Messages(channelID Snowflake) []*Message
	MessageCache(channelID Snowflake) map[Snowflake]*Message
	AllMessageCache() map[Snowflake]map[Snowflake]*Message
	CacheMessage(message *Message) *Message
	UncacheMessage(channelID Snowflake, messageID Snowflake)

	Member(Snowflake, Snowflake) *Member
	MemberByTag(Snowflake, string) *Member
	MembersByName(Snowflake, string, bool) []*Member
	Members(Snowflake) []*Member
	AllMembers() []*Member
	MemberCache(Snowflake) map[Snowflake]*Member
	AllMemberCache() map[Snowflake]map[Snowflake]*Member
	CacheMember(member *Member) *Member
	UncacheMember(Snowflake, Snowflake)
	FindMember(Snowflake, func(*Member) bool) *Member
	FindMembers(Snowflake, func(*Member) bool) []*Member

	VoiceState(guildID Snowflake, userID Snowflake) *VoiceState
	VoiceStates(guildID Snowflake) []*VoiceState
	VoiceStateCache(guildID Snowflake) map[Snowflake]*VoiceState
	CacheVoiceState(voiceState *VoiceState) *VoiceState
	UncacheVoiceState(guildID Snowflake, userID Snowflake)

	Role(roleID Snowflake) *Role
	RolesByName(Snowflake, string, bool) []*Role
	Roles(Snowflake) []*Role
	AllRoles() []*Role
	RoleCache(Snowflake) map[Snowflake]*Role
	AllRoleCache() map[Snowflake]map[Snowflake]*Role
	CacheRole(*Role) *Role
	UncacheRole(Snowflake, Snowflake)
	FindRole(Snowflake, func(*Role) bool) *Role
	FindRoles(Snowflake, func(*Role) bool) []*Role

	DMChannel(Snowflake) *DMChannel
	DMChannels() []*DMChannel
	DMChannelCache() map[Snowflake]*DMChannel
	CacheDMChannel(*DMChannel) *DMChannel
	UncacheDMChannel(dmChannelID Snowflake)
	FindDMChannel(func(*DMChannel) bool) *DMChannel
	FindDMChannels(func(*DMChannel) bool) []*DMChannel

	Channel(Snowflake) *Channel
	MessageChannel(Snowflake) *MessageChannel
	GuildChannel(Snowflake) *GuildChannel

	TextChannel(Snowflake) *TextChannel
	TextChannelsByName(Snowflake, string, bool) []*TextChannel
	TextChannels(Snowflake) []*TextChannel
	TextChannelCache(Snowflake) map[Snowflake]*TextChannel
	CacheTextChannel(*TextChannel) *TextChannel
	UncacheTextChannel(Snowflake, Snowflake)
	FindTextChannel(Snowflake, func(*TextChannel) bool) *TextChannel
	FindTextChannels(Snowflake, func(*TextChannel) bool) []*TextChannel

	StoreChannel(Snowflake) *StoreChannel
	StoreChannelsByName(Snowflake, string, bool) []*StoreChannel
	StoreChannels(Snowflake) []*StoreChannel
	StoreChannelCache(Snowflake) map[Snowflake]*StoreChannel
	CacheStoreChannel(*StoreChannel) *StoreChannel
	UncacheStoreChannel(Snowflake, Snowflake)
	FindStoreChannel(Snowflake, func(*StoreChannel) bool) *StoreChannel
	FindStoreChannels(Snowflake, func(*StoreChannel) bool) []*StoreChannel

	VoiceChannel(Snowflake) *VoiceChannel
	VoiceChannelsByName(Snowflake, string, bool) []*VoiceChannel
	VoiceChannels(Snowflake) []*VoiceChannel
	VoiceChannelCache(Snowflake) map[Snowflake]*VoiceChannel
	CacheVoiceChannel(*VoiceChannel) *VoiceChannel
	UncacheVoiceChannel(Snowflake, Snowflake)
	FindVoiceChannel(Snowflake, func(*VoiceChannel) bool) *VoiceChannel
	FindVoiceChannels(Snowflake, func(*VoiceChannel) bool) []*VoiceChannel

	Category(Snowflake) *Category
	CategoriesByName(Snowflake, string, bool) []*Category
	Categories(Snowflake) []*Category
	AllCategories() []*Category
	CategoryCache(Snowflake) map[Snowflake]*Category
	AllCategoryCache() map[Snowflake]map[Snowflake]*Category
	CacheCategory(*Category) *Category
	UncacheCategory(Snowflake, Snowflake)
	FindCategory(Snowflake, func(*Category) bool) *Category
	FindCategories(Snowflake, func(*Category) bool) []*Category

	Emote(emoteID Snowflake) *Emote
	EmotesByName(guildID Snowflake, name string, ignoreCase bool) []*Emote
	Emotes(guildID Snowflake) []*Emote
	EmoteCache(guildID Snowflake) map[Snowflake]*Emote
	AllEmoteCache() map[Snowflake]map[Snowflake]*Emote
	CacheEmote(*Emote) *Emote
	UncacheEmote(guildID Snowflake, emoteID Snowflake)
}

Cache allows you to access the objects that are stored in-memory by Discord

type CacheFlags added in v0.2.0

type CacheFlags int

CacheFlags are used to enable/disable certain internal caches

const (
	CacheFlagsNone      CacheFlags = 0
	CacheFlagDMChannels CacheFlags = 1 << iota
	CacheFlagCategories
	CacheFlagTextChannels
	CacheFlagVoiceChannels
	CacheFlagStoreChannels
	CacheFlagRoles
	CacheFlagEmotes
	CacheFlagVoiceState
	CacheFlagCommands
	CacheFlagCommandPermissions

	CacheFlagsDefault = CacheFlagDMChannels |
		CacheFlagCategories |
		CacheFlagTextChannels |
		CacheFlagVoiceChannels |
		CacheFlagStoreChannels |
		CacheFlagRoles |
		CacheFlagEmotes
)

values for CacheFlags

func (CacheFlags) Add added in v0.2.0

func (c CacheFlags) Add(bits ...Bit) Bit

Add allows you to add multiple bits together, producing a new bit

func (CacheFlags) Has added in v0.2.0

func (c CacheFlags) Has(bit Bit) bool

Has will check whether the Bit contains another bit

func (CacheFlags) HasAll added in v0.2.0

func (c CacheFlags) HasAll(bits ...Bit) bool

HasAll will ensure that the bit includes all of the bits entered

func (CacheFlags) Missing added in v0.2.0

func (c CacheFlags) Missing(bit Bit) bool

Missing will do the inverse of Bit.Has

func (CacheFlags) MissingAny added in v0.2.0

func (c CacheFlags) MissingAny(bits ...Bit) bool

MissingAny will check whether the bit is missing any one of the bits

func (CacheFlags) Remove added in v0.2.0

func (c CacheFlags) Remove(bits ...Bit) Bit

Remove allows you to subtract multiple bits from the first, producing a new bit

type CacheStrategy added in v0.2.0

type CacheStrategy func(disgo Disgo) bool

CacheStrategy is used to determine whether something should be cached when making an api request. When using the gateway, you'll receive the event shortly afterwards if you have the correct intents.

var (
	CacheStrategyYes  CacheStrategy = func(disgo Disgo) bool { return true }
	CacheStrategyNo   CacheStrategy = func(disgo Disgo) bool { return true }
	CacheStrategyNoWs CacheStrategy = func(disgo Disgo) bool { return disgo.HasGateway() }
)

Default cache strategy choices

type Category

type Category struct {
	GuildChannel
}

Category groups text & voice channels in servers together

type Channel

type Channel struct {
	Disgo            Disgo
	ID               Snowflake    `json:"id"`
	Name             *string      `json:"name,omitempty"`
	Type             ChannelType  `json:"type"`
	LastMessageID    *Snowflake   `json:"last_message_id,omitempty"`
	GuildID          *Snowflake   `json:"guild_id,omitempty"`
	Position         *int         `json:"position,omitempty"`
	Topic            *string      `json:"topic,omitempty"`
	NSFW             *bool        `json:"nsfw,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"`
	ParentID         *Snowflake   `json:"parent_id,omitempty"`
	Permissions      *Permissions `json:"permissions,omitempty"`
}

Channel is a generic discord channel object

type ChannelType

type ChannelType int

ChannelType for interacting with discord's channels

const (
	ChannelTypeText ChannelType = iota
	ChannelTypeDM
	ChannelTypeVoice
	ChannelTypeGroupDM
	ChannelTypeCategory
	ChannelTypeNews
	ChannelTypeStore
)

Channel constants

type Color

type Color int

Color is used for specifying colors in an Embed / Role

type Command added in v0.2.0

type Command struct {
	Disgo             Disgo
	GuildPermissions  map[Snowflake]*GuildCommandPermissions
	GuildID           *Snowflake       `json:"guild_id"`
	ID                Snowflake        `json:"id,omitempty"`
	ApplicationID     Snowflake        `json:"application_id,omitempty"`
	Name              string           `json:"name"`
	Description       string           `json:"description"`
	DefaultPermission *bool            `json:"default_permission,omitempty"`
	Options           []*CommandOption `json:"options,omitempty"`
}

Command is the base "command" model that belongs to an application.

func (Command) Delete added in v0.2.0

func (c Command) Delete() error

Delete deletes the Command from discord

func (*Command) Fetch added in v0.2.0

func (c *Command) Fetch() error

Fetch updates/fetches the current Command from discord

func (*Command) FetchPermissions added in v0.2.0

func (c *Command) FetchPermissions(guildID Snowflake) (*GuildCommandPermissions, error)

FetchPermissions fetched the GuildCommandPermissions for a specific Guild from discord

func (Command) FromGuild added in v0.2.0

func (c Command) FromGuild() bool

FromGuild returns true if this is a guild Command else false

func (Command) GetPermissions added in v0.2.0

func (c Command) GetPermissions(guildID Snowflake) *GuildCommandPermissions

GetPermissions returns the GuildCommandPermissions for the specific Guild from the Cache

func (Command) Guild added in v0.2.0

func (c Command) Guild() *Guild

Guild returns the Guild the Command is from from the Cache or nil if it is a global Command

func (*Command) SetPermissions added in v0.2.0

func (c *Command) SetPermissions(guildID Snowflake, permissions ...*CommandPermission) error

SetPermissions sets the GuildCommandPermissions for a specific Guild. this overrides all existing CommandPermission(s). thx discord for that

func (*Command) Update added in v0.2.0

func (c *Command) Update(command *CommandUpdate) error

Update updates the current Command with the given fields

type CommandCreate added in v0.3.0

type CommandCreate struct {
	Name              string           `json:"name,omitempty"`
	Description       string           `json:"description,omitempty"`
	DefaultPermission *bool            `json:"default_permission,omitempty"`
	Options           []*CommandOption `json:"options,omitempty"`
}

CommandCreate is used to create an Command. all fields are optional

type CommandOption

type CommandOption struct {
	Type        CommandOptionType `json:"type"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Required    bool              `json:"required,omitempty"`
	Choices     []*OptionChoice   `json:"choices,omitempty"`
	Options     []*CommandOption  `json:"options,omitempty"`
}

CommandOption are the arguments used in Command.Options

type CommandOptionType added in v0.2.0

type CommandOptionType int

CommandOptionType specifies the type of the arguments used in Command.Options

const (
	CommandOptionTypeSubCommand CommandOptionType = iota + 1
	CommandOptionTypeSubCommandGroup
	CommandOptionTypeString
	CommandOptionTypeInteger
	CommandOptionTypeBoolean
	CommandOptionTypeUser
	CommandOptionTypeChannel
	CommandOptionTypeRole
)

Constants for each slash command option type

type CommandPermission added in v0.2.0

type CommandPermission struct {
	ID         Snowflake             `json:"id"`
	Type       CommandPermissionType `json:"type"`
	Permission bool                  `json:"permission"`
}

CommandPermission holds a User or Role and if they are allowed to use the Command

type CommandPermissionType added in v0.2.0

type CommandPermissionType int

CommandPermissionType is the type of the CommandPermission

type CommandUpdate added in v0.3.0

type CommandUpdate struct {
	Name              *string          `json:"name,omitempty"`
	Description       *string          `json:"description,omitempty"`
	DefaultPermission *bool            `json:"default_permission,omitempty"`
	Options           []*CommandOption `json:"options,omitempty"`
}

CommandUpdate is used to update an existing Command. all fields are optional

type DMChannel

type DMChannel struct {
	MessageChannel
}

DMChannel is used for interacting in private Message(s) with users

type DeconstructedSnowflake

type DeconstructedSnowflake struct {
	Timestamp int64
	WorkerID  int64
	ProcessID int64
	Increment int64
	Binary    string
}

DeconstructedSnowflake contains the properties used by Discord for each ID

type Disgo

type Disgo interface {
	Logger() log.Logger
	Connect() error
	Start()
	Close()
	Token() string
	Gateway() Gateway
	RestClient() RestClient
	WebhookServer() WebhookServer
	Cache() Cache
	Intents() Intents
	RawGatewayEventsEnabled() bool
	ApplicationID() Snowflake
	SelfUser() *User
	EntityBuilder() EntityBuilder
	EventManager() EventManager
	VoiceDispatchInterceptor() VoiceDispatchInterceptor
	SetVoiceDispatchInterceptor(voiceInterceptor VoiceDispatchInterceptor)
	AudioController() AudioController
	HeartbeatLatency() time.Duration
	LargeThreshold() int
	HasGateway() bool

	GetCommand(commandID Snowflake) (*Command, error)
	GetCommands() ([]*Command, error)
	CreateCommand(command *CommandCreate) (*Command, error)
	EditCommand(commandID Snowflake, command *CommandUpdate) (*Command, error)
	DeleteCommand(commandID Snowflake) error
	SetCommands(commands ...*CommandCreate) ([]*Command, error)
}

Disgo is the main discord interface

type DisgoBuilder

type DisgoBuilder interface {
	SetLogger(level log.Logger) DisgoBuilder
	SetToken(token string) DisgoBuilder
	SetHTTPClient(httpClient *http.Client) DisgoBuilder
	SetIntents(intents Intents) DisgoBuilder
	SetRawGatewayEventsEnabled(enabled bool) DisgoBuilder
	SetVoiceDispatchInterceptor(voiceDispatchInterceptor VoiceDispatchInterceptor) DisgoBuilder
	SetEntityBuilder(entityBuilder EntityBuilder) DisgoBuilder
	SetEventManager(eventManager EventManager) DisgoBuilder
	AddEventListeners(eventsListeners ...EventListener) DisgoBuilder
	SetWebhookServer(webhookServer WebhookServer) DisgoBuilder
	SetWebhookServerProperties(listenURL string, listenPort int, publicKey string) DisgoBuilder
	SetRestClient(restClient RestClient) DisgoBuilder
	SetCache(cache Cache) DisgoBuilder
	SetMemberCachePolicy(memberCachePolicy MemberCachePolicy) DisgoBuilder
	SetMessageCachePolicy(messageCachePolicy MessageCachePolicy) DisgoBuilder
	SetCacheFlags(cacheFlags CacheFlags) DisgoBuilder
	SetGateway(gateway Gateway) DisgoBuilder
	Build() (Disgo, error)
}

DisgoBuilder allows you to create a Disgo client through a series of methods

type Embed

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

Embed allows you to send embeds to discord

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

The EmbedAuthor of an Embed

type EmbedBuilder

type EmbedBuilder struct {
	Embed
}

EmbedBuilder allows you to create embeds and use methods to set values

func NewEmbedBuilder

func NewEmbedBuilder() *EmbedBuilder

NewEmbedBuilder returns a new embed builder

func (*EmbedBuilder) AddField

func (b *EmbedBuilder) AddField(name string, value string, inline bool) *EmbedBuilder

AddField adds a field to the EmbedBuilder by name and value

func (*EmbedBuilder) AddFields

func (b *EmbedBuilder) AddFields(field *EmbedField, fields ...*EmbedField) *EmbedBuilder

AddFields adds multiple fields to the EmbedBuilder

func (*EmbedBuilder) Build

func (b *EmbedBuilder) Build() *Embed

Build returns your built Embed

func (*EmbedBuilder) ClearFields

func (b *EmbedBuilder) ClearFields() *EmbedBuilder

ClearFields removes all of the fields from the EmbedBuilder

func (*EmbedBuilder) RemoveField

func (b *EmbedBuilder) RemoveField(i int) *EmbedBuilder

RemoveField removes a field from the EmbedBuilder

func (*EmbedBuilder) SetAuthor

func (b *EmbedBuilder) SetAuthor(name string, url string, iconURL string) *EmbedBuilder

SetAuthor sets the author of the EmbedBuilder without an Icon URL

func (*EmbedBuilder) SetAuthorIcon added in v0.3.0

func (b *EmbedBuilder) SetAuthorIcon(iconURL string) *EmbedBuilder

SetAuthorIcon sets the author of the EmbedBuilder with all properties

func (*EmbedBuilder) SetAuthorName added in v0.3.0

func (b *EmbedBuilder) SetAuthorName(name string) *EmbedBuilder

SetAuthorName sets the author of the EmbedBuilder

func (*EmbedBuilder) SetAuthorURL added in v0.3.0

func (b *EmbedBuilder) SetAuthorURL(url string) *EmbedBuilder

SetAuthorURL sets the author of the EmbedBuilder with an URL

func (*EmbedBuilder) SetColor

func (b *EmbedBuilder) SetColor(color int) *EmbedBuilder

SetColor sets the color of the EmbedBuilder

func (*EmbedBuilder) SetDescription

func (b *EmbedBuilder) SetDescription(description string) *EmbedBuilder

SetDescription sets the description of the EmbedBuilder

func (*EmbedBuilder) SetDescriptionf

func (b *EmbedBuilder) SetDescriptionf(description string, a ...interface{}) *EmbedBuilder

SetDescriptionf sets the description of the EmbedBuilder with format

func (*EmbedBuilder) SetEmbedAuthor added in v0.2.0

func (b *EmbedBuilder) SetEmbedAuthor(author *EmbedAuthor) *EmbedBuilder

SetEmbedAuthor sets the author of the EmbedBuilder using an EmbedAuthor struct

func (*EmbedBuilder) SetEmbedFooter added in v0.3.0

func (b *EmbedBuilder) SetEmbedFooter(footer *EmbedFooter) *EmbedBuilder

SetEmbedFooter sets the footer of the EmbedBuilder

func (*EmbedBuilder) SetField added in v0.2.0

func (b *EmbedBuilder) SetField(i int, name string, value string, inline bool) *EmbedBuilder

SetField sets a field to the EmbedBuilder by name and value

func (*EmbedBuilder) SetFields

func (b *EmbedBuilder) SetFields(fields ...*EmbedField) *EmbedBuilder

SetFields sets fields of the EmbedBuilder

func (*EmbedBuilder) SetFooter

func (b *EmbedBuilder) SetFooter(text string, iconURL string) *EmbedBuilder

SetFooter sets the footer of the EmbedBuilder

func (*EmbedBuilder) SetFooterIcon added in v0.3.0

func (b *EmbedBuilder) SetFooterIcon(iconURL string) *EmbedBuilder

SetFooterIcon sets the footer of the EmbedBuilder by iconURL

func (*EmbedBuilder) SetFooterText added in v0.3.0

func (b *EmbedBuilder) SetFooterText(text string) *EmbedBuilder

SetFooterText sets the footer of the EmbedBuilder by text

func (*EmbedBuilder) SetImage

func (b *EmbedBuilder) SetImage(url string) *EmbedBuilder

SetImage sets the image of the EmbedBuilder

func (*EmbedBuilder) SetThumbnail

func (b *EmbedBuilder) SetThumbnail(url string) *EmbedBuilder

SetThumbnail sets the thumbnail of the EmbedBuilder

func (*EmbedBuilder) SetTitle

func (b *EmbedBuilder) SetTitle(title string) *EmbedBuilder

SetTitle sets the title of the EmbedBuilder

func (*EmbedBuilder) SetTitlef added in v0.3.0

func (b *EmbedBuilder) SetTitlef(title string, a ...interface{}) *EmbedBuilder

SetTitlef sets the title of the EmbedBuilder with format

func (*EmbedBuilder) SetURL

func (b *EmbedBuilder) SetURL(url string) *EmbedBuilder

SetURL sets the URL of the EmbedBuilder

type EmbedField

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

EmbedField (s) of an Embed

type EmbedFooter

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

The EmbedFooter of an Embed

type EmbedProvider

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

The EmbedProvider of an Embed

type EmbedResource

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

The EmbedResource of an Embed.Image/Embed.Thumbnail/Embed.Video

type EmbedType

type EmbedType string

EmbedType is the type of an Embed

const (
	EmbedTypeRich    EmbedType = "rich"
	EmbedTypeImage   EmbedType = "image"
	EmbedTypeVideo   EmbedType = "video"
	EmbedTypeGifV    EmbedType = "rich"
	EmbedTypeArticle EmbedType = "article"
	EmbedTypeLink    EmbedType = "link"
)

Constants for EmbedType

type Emote

type Emote struct {
	Disgo    Disgo
	ID       Snowflake
	GuildID  Snowflake
	Name     string
	Animated bool
}

An Emote allows you to interact with custom emojis in discord.

func (Emote) Guild added in v0.2.0

func (e Emote) Guild() *Guild

Guild returns the Guild of the Emote from the Cache

func (Emote) Mention

func (e Emote) Mention() string

Mention returns the string used to send the emoji

func (Emote) Reaction

func (e Emote) Reaction() string

Reaction returns the identifier used for adding and removing reactions for messages in discord

func (Emote) String

func (e Emote) String() string

String formats the Emote as string

type EntityBuilder added in v0.2.0

type EntityBuilder interface {
	Disgo() Disgo

	CreateInteraction(interaction *Interaction, updateCache CacheStrategy) *Interaction

	CreateGlobalCommand(command *Command, updateCache CacheStrategy) *Command

	CreateUser(user *User, updateCache CacheStrategy) *User

	CreateMessage(message *Message, updateCache CacheStrategy) *Message

	CreateGuild(guild *Guild, updateCache CacheStrategy) *Guild
	CreateMember(guildID Snowflake, member *Member, updateCache CacheStrategy) *Member
	CreateGuildCommand(guildID Snowflake, command *Command, updateCache CacheStrategy) *Command
	CreateGuildCommandPermissions(guildCommandPermissions *GuildCommandPermissions, updateCache CacheStrategy) *GuildCommandPermissions
	CreateRole(guildID Snowflake, role *Role, updateCache CacheStrategy) *Role
	CreateVoiceState(guildID Snowflake, voiceState *VoiceState, updateCache CacheStrategy) *VoiceState

	CreateTextChannel(channel *Channel, updateCache CacheStrategy) *TextChannel
	CreateVoiceChannel(channel *Channel, updateCache CacheStrategy) *VoiceChannel
	CreateStoreChannel(channel *Channel, updateCache CacheStrategy) *StoreChannel
	CreateCategory(channel *Channel, updateCache CacheStrategy) *Category
	CreateDMChannel(channel *Channel, updateCache CacheStrategy) *DMChannel

	CreateEmote(guildID Snowflake, emote *Emote, updateCache CacheStrategy) *Emote
}

EntityBuilder is used to create structs for disgo's cache

type ErrorResponse

type ErrorResponse struct {
	Code    int
	Message string
}

ErrorResponse contains custom errors from discord

type Event

type Event interface {
	Disgo() Disgo
	SequenceNumber() int
}

Event the basic interface each event implement

type EventHandler

type EventHandler interface {
	Event() GatewayEventType
	New() interface{}
}

EventHandler provides info about the EventHandler

type EventListener

type EventListener interface {
	OnEvent(event interface{})
}

EventListener is used to create new EventListener to listen to events

type EventManager

type EventManager interface {
	Disgo() Disgo
	Close()
	AddEventListeners(eventListeners ...EventListener)
	Handle(eventType GatewayEventType, replyChannel chan interface{}, sequenceNumber int, payload json.RawMessage)
	Dispatch(event Event)
}

EventManager lets you listen for specific events triggered by raw gateway events

type ExpandedInvite added in v0.2.0

type ExpandedInvite struct {
	Invite
	Uses      int       `json:"uses"`
	MaxUses   int       `json:"max_uses"`
	MaxAge    int       `json:"max_age"`
	Temporary bool      `json:"temporary"`
	CreatedAt time.Time `json:"created_at"`
}

ExpandedInvite is a full Invite struct

type ExplicitContentFilterLevel

type ExplicitContentFilterLevel int

The ExplicitContentFilterLevel of a Guild

const (
	ExplicitContentFilterLevelDisabled ExplicitContentFilterLevel = iota
	ExplicitContentFilterLevelMembersWithoutRoles
	ExplicitContentFilterLevelAllMembers
)

Constants for ExplicitContentFilterLevel

type FollowupMessage

type FollowupMessage struct {
	Content         *string          `json:"content,omitempty"`
	TTS             *bool            `json:"tts,omitempty"`
	Embeds          []*Embed         `json:"embeds,omitempty"`
	AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"`
	Flags           *MessageFlags    `json:"flags,omitempty"`
}

FollowupMessage is used to add additional messages to an Interaction after you've responded initially

type FollowupMessageBuilder added in v0.2.0

type FollowupMessageBuilder struct {
	FollowupMessage
}

FollowupMessageBuilder allows you to create an FollowupMessage with ease

func NewFollowupMessageBuilder added in v0.2.0

func NewFollowupMessageBuilder() *FollowupMessageBuilder

NewFollowupMessageBuilder returns a new FollowupMessageBuilder

func (*FollowupMessageBuilder) AddEmbeds added in v0.2.0

func (b *FollowupMessageBuilder) AddEmbeds(embeds ...*Embed) *FollowupMessageBuilder

AddEmbeds adds multiple embeds to the FollowupMessage

func (*FollowupMessageBuilder) Build added in v0.2.0

Build returns your built FollowupMessage

func (*FollowupMessageBuilder) ClearEmbeds added in v0.2.0

ClearEmbeds removes all of the embeds from the FollowupMessage

func (*FollowupMessageBuilder) RemoveEmbed added in v0.2.0

func (b *FollowupMessageBuilder) RemoveEmbed(index int) *FollowupMessageBuilder

RemoveEmbed removes an embed from the FollowupMessage

func (*FollowupMessageBuilder) SetAllowedMentions added in v0.2.0

func (b *FollowupMessageBuilder) SetAllowedMentions(allowedMentions *AllowedMentions) *FollowupMessageBuilder

SetAllowedMentions sets the allowed mentions of the FollowupMessage

func (*FollowupMessageBuilder) SetAllowedMentionsEmpty added in v0.2.0

func (b *FollowupMessageBuilder) SetAllowedMentionsEmpty() *FollowupMessageBuilder

SetAllowedMentionsEmpty sets the allowed mentions of the FollowupMessage to nothing

func (*FollowupMessageBuilder) SetContent added in v0.2.0

func (b *FollowupMessageBuilder) SetContent(content string) *FollowupMessageBuilder

SetContent sets the content of the FollowupMessage

func (*FollowupMessageBuilder) SetContentf added in v0.3.0

func (b *FollowupMessageBuilder) SetContentf(content string, a ...interface{}) *FollowupMessageBuilder

SetContentf sets the content of the FollowupMessage with format

func (*FollowupMessageBuilder) SetEmbeds added in v0.2.0

func (b *FollowupMessageBuilder) SetEmbeds(embeds ...*Embed) *FollowupMessageBuilder

SetEmbeds sets the embeds of the FollowupMessage

func (*FollowupMessageBuilder) SetEphemeral added in v0.2.0

func (b *FollowupMessageBuilder) SetEphemeral(ephemeral bool) *FollowupMessageBuilder

SetEphemeral adds/removes MessageFlagEphemeral to the message flags

func (*FollowupMessageBuilder) SetFlags added in v0.2.0

SetFlags sets the message flags of the FollowupMessage

func (*FollowupMessageBuilder) SetTTS added in v0.2.0

SetTTS sets if the FollowupMessage is a tts message

type FullGuild added in v0.2.0

type FullGuild struct {
	*Guild
	Roles       []*Role       `json:"roles"`
	Emotes      []*Emote      `json:"emojis"`
	Members     []*Member     `json:"members"`
	Channels    []*Channel    `json:"channels"`
	VoiceStates []*VoiceState `json:"voice_states"`
}

FullGuild represents a Guild objects sent by discord with the GatewayEventGuildCreate

type Gateway

type Gateway interface {
	Disgo() Disgo
	Open() error
	Status() GatewayStatus
	Close()
	Conn() *websocket.Conn
	Latency() time.Duration
}

Gateway is what is used to connect to discord

type GatewayBotRs

type GatewayBotRs struct {
	URL               string `json:"url"`
	Shards            int    `json:"shards"`
	SessionStartLimit struct {
		Total          int `json:"total"`
		Remaining      int `json:"remaining"`
		ResetAfter     int `json:"reset_after"`
		MaxConcurrency int `json:"max_concurrency"`
	} `json:"session_start_limit"`
}

GatewayBotRs contains the response for GET /gateway/bot

type GatewayCommand

type GatewayCommand struct {
	GatewayPacket
	D interface{} `json:"d"`
}

GatewayCommand object is used when sending data to discord's websocket, it's recommended that you don't use these

func NewGatewayCommand added in v0.2.0

func NewGatewayCommand(op GatewayOp, d interface{}) GatewayCommand

NewGatewayCommand returns a new GatewayCommand struct with the given payload

type GatewayEventHandler

type GatewayEventHandler interface {
	EventHandler
	HandleGatewayEvent(disgo Disgo, eventManager EventManager, sequenceNumber int, payload interface{})
}

GatewayEventHandler is used to handle raw gateway events

type GatewayEventType added in v0.2.0

type GatewayEventType string

GatewayEventType wraps all GatewayEventType types

const (
	GatewayEventApplicationCommandCreate GatewayEventType = "APPLICATION_COMMAND_CREATE"
	GatewayEventApplicationCommandUpdate GatewayEventType = "APPLICATION_COMMAND_UPDATE"
	GatewayEventApplicationCommandDelete GatewayEventType = "APPLICATION_COMMAND_DELETE"
	GatewayEventChannelCreate            GatewayEventType = "CHANNEL_CREATE"
	GatewayEventChannelDelete            GatewayEventType = "CHANNEL_DELETE"
	GatewayEventChannelPinsUpdate        GatewayEventType = "CHANNEL_PINS_UPDATE"
	GatewayEventChannelUpdate            GatewayEventType = "CHANNEL_UPDATE"
	GatewayEventGuildBanAdd              GatewayEventType = "GUILD_BAN_ADD"
	GatewayEventGuildBanRemove           GatewayEventType = "GUILD_BAN_REMOVE"
	GatewayEventGuildCreate              GatewayEventType = "GUILD_CREATE"
	GatewayEventGuildDelete              GatewayEventType = "GUILD_DELETE"
	GatewayEventGuildEmojisUpdate        GatewayEventType = "GUILD_EMOJIS_UPDATE"
	GatewayEventGuildIntegrationsUpdate  GatewayEventType = "GUILD_INTEGRATIONS_UPDATE"
	GatewayEventGuildMemberAdd           GatewayEventType = "GUILD_MEMBER_ADD"
	GatewayEventGuildMemberRemove        GatewayEventType = "GUILD_MEMBER_REMOVE"
	GatewayEventGuildMemberUpdate        GatewayEventType = "GUILD_MEMBER_UPDATE"
	GatewayEventGuildMembersChunk        GatewayEventType = "GUILD_MEMBERS_CHUNK"
	GatewayEventGuildRoleCreate          GatewayEventType = "GUILD_ROLE_CREATE"
	GatewayEventGuildRoleDelete          GatewayEventType = "GUILD_ROLE_DELETE"
	GatewayEventGuildRoleUpdate          GatewayEventType = "GUILD_ROLE_UPDATE"
	GatewayEventGuildUpdate              GatewayEventType = "GUILD_UPDATE"
	GatewayEventInteractionCreate        GatewayEventType = "INTERACTION_CREATE"
	WebhookEventInteractionCreate        GatewayEventType = "INTERACTION_WEBHOOK_CREATE"
	GatewayEventMessageAck               GatewayEventType = "MESSAGE_ACK"
	GatewayEventMessageCreate            GatewayEventType = "MESSAGE_CREATE"
	GatewayEventMessageDelete            GatewayEventType = "MESSAGE_DELETE"
	GatewayEventMessageDeleteBulk        GatewayEventType = "MESSAGE_DELETE_BULK"
	GatewayEventMessageReactionAdd       GatewayEventType = "MESSAGE_REACTION_ADD"
	GatewayEventMessageReactionRemove    GatewayEventType = "MESSAGE_REACTION_REMOVE"
	GatewayEventMessageReactionRemoveAll GatewayEventType = "MESSAGE_REACTION_REMOVE_ALL"
	GatewayEventMessageUpdate            GatewayEventType = "MESSAGE_UPDATE"
	GatewayEventPresenceUpdate           GatewayEventType = "PRESENCE_UPDATE"
	GatewayEventPresencesReplace         GatewayEventType = "PRESENCES_REPLACE"
	GatewayEventReady                    GatewayEventType = "READY"
	GatewayEventResumed                  GatewayEventType = "RESUMED"
	GatewayEventTypingStart              GatewayEventType = "TYPING_START"
	GatewayEventUserGuildSettingsUpdate  GatewayEventType = "USER_GUILD_SETTINGS_UPDATE"
	GatewayEventUserNoteUpdate           GatewayEventType = "USER_NOTE_UPDATE"
	GatewayEventUserSettingsUpdate       GatewayEventType = "USER_SETTINGS_UPDATE"
	GatewayEventUserUpdate               GatewayEventType = "USER_UPDATE"
	GatewayEventVoiceServerUpdate        GatewayEventType = "VOICE_SERVER_UPDATE"
	GatewayEventVoiceStateUpdate         GatewayEventType = "VOICE_STATE_UPDATE"
	GatewayEventWebhooksUpdate           GatewayEventType = "WEBHOOKS_UPDATE"
)

Constants for the gateway events

type GatewayOp

type GatewayOp int

GatewayOp are opcodes used by discord

const (
	OpDispatch GatewayOp = iota
	OpHeartbeat
	OpIdentify
	OpPresenceUpdate
	OpVoiceStateUpdate

	OpResume
	OpReconnect
	OpRequestGuildMembers
	OpInvalidSession
	OpHello
	OpHeartbeatACK
)

Constants for the gateway opcodes

type GatewayPacket added in v0.2.0

type GatewayPacket struct {
	Op GatewayOp         `json:"op"`
	S  *int              `json:"s,omitempty"`
	T  *GatewayEventType `json:"t,omitempty"`
}

GatewayPacket raw GatewayEvent type

type GatewayRs

type GatewayRs struct {
	URL string `json:"url"`
}

GatewayRs contains the response for GET /gateway

type GatewayStatus added in v0.2.0

type GatewayStatus int

GatewayStatus is the state that the client is currently in

const (
	Ready GatewayStatus = iota
	Unconnected
	Connecting
	Reconnecting
	WaitingForHello
	WaitingForReady
	Disconnected
	WaitingForGuilds
	Identifying
	Resuming
)

Indicates how far along the client is to connecting

type Guild

type Guild struct {
	Disgo                       Disgo
	ID                          Snowflake                  `json:"id"`
	Name                        string                     `json:"name"`
	Icon                        *string                    `json:"icon"`
	Region                      string                     `json:"region"`
	OwnerID                     Snowflake                  `json:"owner_id"`
	JoinedAt                    *time.Time                 `json:"joined_at"`
	DiscoverySplash             *string                    `json:"discovery_splash"`
	Splash                      *string                    `json:"splash"`
	AfkChannelID                *Snowflake                 `json:"afk_channel_id"`
	AfkTimeout                  int                        `json:"afk_timeout"`
	MemberCount                 *int                       `json:"member_count"`
	VerificationLevel           VerificationLevel          `json:"verification_level"`
	Large                       *bool                      `json:"large"`
	DefaultMessageNotifications MessageNotifications       `json:"default_message_notifications"`
	MaxPresences                *int                       `json:"max_presences"`
	MaxMembers                  *int                       `json:"max_members"`
	Unavailable                 bool                       `json:"unavailable"`
	ExplicitContentFilter       ExplicitContentFilterLevel `json:"explicit_content_filter"`
	Features                    []GuildFeature             `json:"features"`
	MfaLevel                    MFALevel                   `json:"mfa_level"`
	ApplicationID               Snowflake                  `json:"application_id"`
	WidgetEnabled               bool                       `json:"widget_enabled"`
	WidgetChannelID             Snowflake                  `json:"widget_channel_id"`
	SystemChannelID             Snowflake                  `json:"system_channel_id"`
	SystemChannelFlags          SystemChannelFlag          `json:"system_channel_flags"`
	RulesChannelID              Snowflake                  `json:"rules_channel_id"`
	VanityURLCode               *string                    `json:"vanity_url_code"`
	Description                 *string                    `json:"description"`
	Banner                      *string                    `json:"banner"`
	PremiumTier                 PremiumTier                `json:"premium_tier"`
	PremiumSubscriptionCount    *int                       `json:"premium_subscription_count"`
	PreferredLocale             string                     `json:"preferred_locale"`
	PublicUpdatesChannelID      *Snowflake                 `json:"public_updates_channel_id"`
	MaxVideoChannelUsers        *int                       `json:"max_video_channel_users"`
	ApproximateMemberCount      *int                       `json:"approximate_member_count"`
	ApproximatePresenceCount    *int                       `json:"approximate_presence_count"`
	WelcomeScreen               *GuildWelcomeScreen        `json:"welcome_screen"`
}

Guild represents a discord guild_events

func (*Guild) AddMember

func (g *Guild) AddMember(userID Snowflake, addGuildMemberData *AddGuildMemberData) (*Member, error)

AddMember adds a member to the guild with the oauth2 access token

func (*Guild) CreateCommand

func (g *Guild) CreateCommand(command *CommandCreate) (*Command, error)

CreateCommand creates a new command for this guild

func (*Guild) CreateRole

func (g *Guild) CreateRole(role *UpdateRole) (*Role, error)

CreateRole allows you to create a new Role

func (*Guild) DeleteCommand

func (g *Guild) DeleteCommand(commandID Snowflake) error

DeleteCommand creates a new command for this guild

func (*Guild) Disconnect added in v0.2.0

func (g *Guild) Disconnect() error

Disconnect sends a api.GatewayCommand to disconnect from this Guild

func (*Guild) EditCommand

func (g *Guild) EditCommand(commandID Snowflake, command *CommandUpdate) (*Command, error)

EditCommand edits a specific guild command

func (*Guild) GetCommand

func (g *Guild) GetCommand(commandID Snowflake) (*Command, error)

GetCommand fetches a specific guild command

func (*Guild) GetCommandPermissions added in v0.2.0

func (g *Guild) GetCommandPermissions(commandID Snowflake) (*GuildCommandPermissions, error)

GetCommandPermissions returns the GuildCommandPermissions for a specific Command in a guild

func (*Guild) GetCommands

func (g *Guild) GetCommands() ([]*Command, error)

GetCommands fetches all guild commands

func (*Guild) GetCommandsPermissions added in v0.2.0

func (g *Guild) GetCommandsPermissions() ([]*GuildCommandPermissions, error)

GetCommandsPermissions returns the GuildCommandPermissions for a all Command(s) in a guild

func (*Guild) IconURL

func (g *Guild) IconURL() *string

IconURL returns the Icon of a guild_events

func (*Guild) SetCommandPermissions added in v0.2.0

func (g *Guild) SetCommandPermissions(commandID Snowflake, permissions *SetGuildCommandPermissions) (*GuildCommandPermissions, error)

SetCommandPermissions sets the GuildCommandPermissions for a specific Command

func (*Guild) SetCommands

func (g *Guild) SetCommands(commands ...*CommandCreate) ([]*Command, error)

SetCommands overrides all commands for this guild

func (*Guild) SetCommandsPermissions added in v0.2.0

func (g *Guild) SetCommandsPermissions(commandPermissions ...*SetGuildCommandPermissions) ([]*GuildCommandPermissions, error)

SetCommandsPermissions sets the GuildCommandPermissions for a all Command(s)

type GuildChannel

type GuildChannel struct {
	Channel
}

GuildChannel is a generic type for all server channels

func (GuildChannel) Guild

func (c GuildChannel) Guild() *Guild

Guild returns the channel's Guild

type GuildCommandPermissions added in v0.2.0

type GuildCommandPermissions struct {
	Disgo         Disgo
	ID            Snowflake            `json:"id"`
	ApplicationID Snowflake            `json:"application_id"`
	GuildID       Snowflake            `json:"guild_id"`
	Permissions   []*CommandPermission `json:"permissions"`
}

GuildCommandPermissions holds all permissions for a Command

type GuildFeature

type GuildFeature string

The GuildFeature (s) that a guild contains

const (
	GuildFeatureInviteSplash                  GuildFeature = "INVITE_SPLASH"
	GuildFeatureVipRegions                    GuildFeature = "VIP_REGIONS"
	GuildFeatureVanityURL                     GuildFeature = "VANITY_URL"
	GuildFeatureVERIFIED                      GuildFeature = "VERIFIED"
	GuildFeaturePARTNERED                     GuildFeature = "PARTNERED"
	GuildFeatureCOMMUNITY                     GuildFeature = "COMMUNITY"
	GuildFeatureCOMMERCE                      GuildFeature = "COMMERCE"
	GuildFeatureNews                          GuildFeature = "NEWS"
	GuildFeatureDiscoverable                  GuildFeature = "DISCOVERABLE"
	GuildFeatureFeaturable                    GuildFeature = "FEATURABLE"
	GuildFeatureAnimatedIcon                  GuildFeature = "ANIMATED_ICON"
	GuildFeatureBANNER                        GuildFeature = "BANNER"
	GuildFeatureWelcomeScreenEnabled          GuildFeature = "WELCOME_SCREEN_ENABLED"
	GuildFeatureMemberVerificationGateEnabled GuildFeature = "MEMBER_VERIFICATION_GATE_ENABLED"
	GuildFeaturePreviewEnabled                GuildFeature = "PREVIEW_ENABLED"
)

Constants for GuildFeature

type GuildPreview added in v0.2.0

type GuildPreview struct {
	Disgo                    Disgo
	ID                       Snowflake      `json:"id"`
	Name                     string         `json:"name"`
	Icon                     *string        `json:"icon"`
	DiscoverySplash          *string        `json:"discovery_splash"`
	Splash                   *string        `json:"splash"`
	Features                 []GuildFeature `json:"features"`
	Description              *string        `json:"description"`
	ApproximateMemberCount   *int           `json:"approximate_member_count"`
	ApproximatePresenceCount *int           `json:"approximate_presence_count"`
	Emojis                   []*Emote       `json:"emojis"`
}

GuildPreview is used for previewing public guilds before joining them

type GuildWelcomeChannel added in v0.2.0

type GuildWelcomeChannel struct {
	ChannelID   Snowflake  `json:"channel_id"`
	Description string     `json:"description"`
	EmojiID     *Snowflake `json:"emoji_id,omitempty"`
	EmojiName   *string    `json:"emoji_name,omitempty"`
}

GuildWelcomeChannel is one of the channels in a GuildWelcomeScreen

type GuildWelcomeScreen added in v0.2.0

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

GuildWelcomeScreen is the Welcome Screen of a Guild

type HeartbeatCommand

type HeartbeatCommand struct {
	D *int `json:"d"`
}

HeartbeatCommand is used to ensure the websocket connection remains open, and disconnect if not.

type HelloGatewayEventData added in v0.2.0

type HelloGatewayEventData struct {
	HeartbeatInterval time.Duration `json:"heartbeat_interval"`
}

HelloGatewayEventData is sent when we connect to the gateway

type IdentifyCommand

type IdentifyCommand struct {
	Token          string                        `json:"token"`
	Properties     IdentifyCommandDataProperties `json:"properties"`
	Compress       bool                          `json:"compress,omitempty"`
	LargeThreshold int                           `json:"large_threshold,omitempty"`
	Intents        Intents                       `json:"intents"`
}

IdentifyCommand is the data used in IdentifyCommand

type IdentifyCommandDataProperties

type IdentifyCommandDataProperties struct {
	OS      string `json:"$os"`      // user OS
	Browser string `json:"$browser"` // library name
	Device  string `json:"$device"`  // library name
}

IdentifyCommandDataProperties is used for specifying to discord which library and OS the bot is using, is automatically handled by the library and should rarely be used.

type Intents

type Intents int64

Intents is an extension of the Bit structure used when identifying with discord

const (
	IntentsGuilds Intents = 1 << iota
	IntentsGuildMembers
	IntentsGuildBans
	IntentsGuildEmojis
	IntentsGuildIntegrations
	IntentsGuildWebhooks
	IntentsGuildInvites
	IntentsGuildVoiceStates
	IntentsGuildPresences
	IntentsGuildMessages
	IntentsGuildMessageReactions
	IntentsGuildMessageTyping
	IntentsDirectMessages
	IntentsDirectMessageReactions
	IntentsDirectMessageTyping

	IntentsAllWithoutPrivileged = IntentsGuilds |
		IntentsGuildBans |
		IntentsGuildEmojis |
		IntentsGuildIntegrations |
		IntentsGuildWebhooks |
		IntentsGuildInvites |
		IntentsGuildVoiceStates |
		IntentsGuildMessages |
		IntentsGuildMessageReactions |
		IntentsGuildMessageTyping |
		IntentsDirectMessages |
		IntentsDirectMessageReactions |
		IntentsDirectMessageTyping
	IntentsAll = IntentsAllWithoutPrivileged |
		IntentsGuildMembers |
		IntentsGuildPresences
	IntentsNone Intents = 0
)

Constants for the different bit offsets of intents

func (Intents) Add

func (p Intents) Add(bits ...Bit) Bit

Add allows you to add multiple bits together, producing a new bit

func (Intents) Has

func (p Intents) Has(bit Bit) bool

Has will check whether the Bit contains another bit

func (Intents) HasAll

func (p Intents) HasAll(bits ...Bit) bool

HasAll will ensure that the bit includes all of the bits entered

func (Intents) Missing

func (p Intents) Missing(bit Bit) bool

Missing will do the inverse of Bit.Has

func (Intents) MissingAny

func (p Intents) MissingAny(bits ...Bit) bool

MissingAny will check whether the bit is missing any one of the bits

func (Intents) Remove

func (p Intents) Remove(bits ...Bit) Bit

Remove allows you to subtract multiple bits from the first, producing a new bit

type Interaction

type Interaction struct {
	ID        Snowflake        `json:"id"`
	Type      InteractionType  `json:"type"`
	Data      *InteractionData `json:"data,omitempty"`
	GuildID   *Snowflake       `json:"guild_id,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"`
}

An Interaction is the slash command object you receive when a user uses one of your commands

type InteractionData

type InteractionData struct {
	ID       Snowflake     `json:"id"`
	Name     string        `json:"name"`
	Resolved *Resolved     `json:"resolved"`
	Options  []*OptionData `json:"options,omitempty"`
}

InteractionData is the command data payload

type InteractionResponse

type InteractionResponse struct {
	Type InteractionResponseType  `json:"type"`
	Data *InteractionResponseData `json:"data,omitempty"`
}

InteractionResponse is how you answer interactions. If an answer is not sent within 3 seconds of receiving it, the interaction is failed, and you will be unable to respond to it.

type InteractionResponseBuilder

type InteractionResponseBuilder struct {
	InteractionResponse
}

InteractionResponseBuilder allows you to create an InteractionResponse with ease

func NewInteractionResponseBuilder

func NewInteractionResponseBuilder() *InteractionResponseBuilder

NewInteractionResponseBuilder returns a new InteractionResponseBuilder

func (*InteractionResponseBuilder) AddEmbeds

AddEmbeds adds multiple embeds to the InteractionResponse

func (*InteractionResponseBuilder) Build

Build returns your built InteractionResponse

func (*InteractionResponseBuilder) ClearEmbeds

ClearEmbeds removes all of the embeds from the InteractionResponse

func (*InteractionResponseBuilder) RemoveEmbed

RemoveEmbed removes an embed from the InteractionResponse

func (*InteractionResponseBuilder) SetAllowedMentions

func (b *InteractionResponseBuilder) SetAllowedMentions(allowedMentions *AllowedMentions) *InteractionResponseBuilder

SetAllowedMentions sets the allowed mentions of the InteractionResponse

func (*InteractionResponseBuilder) SetAllowedMentionsEmpty

func (b *InteractionResponseBuilder) SetAllowedMentionsEmpty() *InteractionResponseBuilder

SetAllowedMentionsEmpty sets the allowed mentions of the InteractionResponse to nothing

func (*InteractionResponseBuilder) SetContent

SetContent sets the content of the InteractionResponse

func (*InteractionResponseBuilder) SetContentf added in v0.3.0

func (b *InteractionResponseBuilder) SetContentf(content string, a ...interface{}) *InteractionResponseBuilder

SetContentf sets the content of the InteractionResponse with format

func (*InteractionResponseBuilder) SetData

SetData sets the InteractionResponseData of the InteractionResponse

func (*InteractionResponseBuilder) SetEmbeds

SetEmbeds sets the embeds of the InteractionResponse

func (*InteractionResponseBuilder) SetEphemeral

func (b *InteractionResponseBuilder) SetEphemeral(ephemeral bool) *InteractionResponseBuilder

SetEphemeral adds/removes MessageFlagEphemeral to the message flags

func (*InteractionResponseBuilder) SetFlags

SetFlags sets the message flags of the InteractionResponse

func (*InteractionResponseBuilder) SetTTS

SetTTS sets if the InteractionResponse is a tts message

func (*InteractionResponseBuilder) SetType

SetType sets the InteractionResponseType of the InteractionResponse

type InteractionResponseData

type InteractionResponseData struct {
	TTS             *bool            `json:"tts,omitempty"`
	Content         *string          `json:"content,omitempty"`
	Embeds          []*Embed         `json:"embeds,omitempty"`
	AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"`
	Flags           *MessageFlags    `json:"flags,omitempty"`
}

The InteractionResponseData is used to specify the message_events options when creating an InteractionResponse

type InteractionResponseType

type InteractionResponseType int

InteractionResponseType indicates the type of slash command response, whether it's responding immediately or deferring to edit your response later

const (
	InteractionResponseTypePong InteractionResponseType = iota + 1

	InteractionResponseTypeChannelMessageWithSource
	InteractionResponseTypeDeferredChannelMessageWithSource
)

Constants for the InteractionResponseType(s)

type InteractionType

type InteractionType int

InteractionType is the type of Interaction

const (
	InteractionTypePing InteractionType = iota + 1
	InteractionTypeApplicationCommand
)

Constants for InteractionType

type Invite added in v0.2.0

type Invite struct {
	Disgo                    Disgo
	Code                     string        `json:"code"`
	Guild                    *InviteGuild  `json:"guild"`
	Channel                  InviteChannel `json:"channel"`
	Inviter                  *User         `json:"inviter"`
	TargetUser               *InviteUser   `json:"target_user"`
	TargetType               *TargetType   `json:"target_user_type"`
	ApproximatePresenceCount *int          `json:"approximate_presence_count"`
	ApproximateMemberCount   *int          `json:"approximate_member_count"`
}

Invite is a partial invite struct

func (Invite) URL added in v0.2.0

func (i Invite) URL() string

URL returns the invite url in format like https://discord.gg/{code}

type InviteChannel added in v0.2.0

type InviteChannel struct {
	ID   string      `json:"id"`
	Name string      `json:"name"`
	Type ChannelType `json:"type"`
}

InviteChannel is the Channel of an invite

type InviteGuild added in v0.2.0

type InviteGuild struct {
	ID                Snowflake         `json:"id"`
	Name              string            `json:"name"`
	Splash            *string           `json:"splash"`
	Banner            *string           `json:"banner"`
	Description       *string           `json:"description"`
	Icon              *string           `json:"icon"`
	Features          []GuildFeature    `json:"features"`
	VerificationLevel VerificationLevel `json:"verification_level"`
	VanityURLCode     *string           `json:"vanity_url_code"`
}

An InviteGuild is the Guild of an Invite

type InviteUser added in v0.2.0

type InviteUser struct {
	ID            string `json:"id"`
	Username      string `json:"username"`
	Avatar        string `json:"avatar"`
	Discriminator string `json:"discriminator"`
}

InviteUser is the user who created an invite

type MFALevel

type MFALevel int

The MFALevel of a Guild

const (
	MFALevelNone MFALevel = iota
	MFALevelElevated
)

Constants for MFALevel

type Member

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

Member is a discord GuildMember

func (Member) AddRole

func (m Member) AddRole(roleID Snowflake) error

AddRole adds a specific role the member

func (Member) EffectiveName added in v0.3.0

func (m Member) EffectiveName() string

EffectiveName returns either the nickname or username depending on if the user has a nickname

func (Member) Guild

func (m Member) Guild() *Guild

Guild returns the members guild from the cache

func (Member) IsOwner

func (m Member) IsOwner() bool

IsOwner returns whether the member is the owner of the guild_events that it belongs to

func (Member) Move

func (m Member) Move(channelID *Snowflake) (*Member, error)

Move moves/kicks the member to/from a voice channel

func (Member) RemoveRole

func (m Member) RemoveRole(roleID Snowflake) error

RemoveRole removes a specific role the member

func (Member) Update

func (m Member) Update(updateGuildMemberData *UpdateGuildMemberData) (*Member, error)

Update updates the member

func (Member) VoiceState added in v0.3.0

func (m Member) VoiceState() *VoiceState

VoiceState returns the VoiceState for this Member from the Cache(requires CacheFlagVoiceState and IntentsGuildVoiceStates)

type MemberCachePolicy

type MemberCachePolicy func(*Member) bool

MemberCachePolicy can be used to define your own policy for caching members

var (
	MemberCachePolicyNone    MemberCachePolicy = func(_ *Member) bool { return false }
	MemberCachePolicyAll     MemberCachePolicy = func(_ *Member) bool { return true }
	MemberCachePolicyOwner   MemberCachePolicy = func(member *Member) bool { return member.IsOwner() }
	MemberCachePolicyOnline  MemberCachePolicy = func(_ *Member) bool { return false }
	MemberCachePolicyVoice   MemberCachePolicy = func(member *Member) bool { return false }
	MemberCachePolicyPending MemberCachePolicy = func(member *Member) bool { return member.Pending }
	MemberCachePolicyDefault                   = MemberCachePolicyOwner.Or(MemberCachePolicyVoice)
)

Default member cache policies

func MemberCachePolicyAllOf

func MemberCachePolicyAllOf(policy MemberCachePolicy, policies ...MemberCachePolicy) MemberCachePolicy

MemberCachePolicyAllOf is a shorthand for MemberCachePolicy.And(MemberCachePolicy).And(MemberCachePolicy) etc.

func MemberCachePolicyAnyOf

func MemberCachePolicyAnyOf(policy MemberCachePolicy, policies ...MemberCachePolicy) MemberCachePolicy

MemberCachePolicyAnyOf is a shorthand for MemberCachePolicy.Or(MemberCachePolicy).Or(MemberCachePolicy) etc.

func (MemberCachePolicy) And

And allows you to require both policies to be true for the member to be cached

func (MemberCachePolicy) Or

Or allows you to combine that policy with another, meaning either needs to be true

type Mentionable

type Mentionable interface {
	Mention() string
}

Mentionable is a struct for Mention parsing and AllowedMentions

type Message

type Message struct {
	Disgo             Disgo
	ID                Snowflake            `json:"id"`
	GuildID           *Snowflake           `json:"guild_id"`
	Reactions         []*MessageReaction   `json:"reactions"`
	Attachments       []*MessageAttachment `json:"attachments"`
	TTS               bool                 `json:"tts"`
	Embeds            []*Embed             `json:"embeds,omitempty"`
	CreatedAt         time.Time            `json:"timestamp"`
	Mentions          []interface{}        `json:"mentions"`
	MentionEveryone   bool                 `json:"mention_everyone"`
	MentionRoles      []*Role              `json:"mention_roles"`
	MentionChannels   []*Channel           `json:"mention_channels"`
	Pinned            bool                 `json:"pinned"`
	EditedTimestamp   *time.Time           `json:"edited_timestamp"`
	Author            *User                `json:"author"`
	Member            *Member              `json:"member"`
	Content           *string              `json:"content,omitempty"`
	ChannelID         Snowflake            `json:"channel_id"`
	Type              MessageType          `json:"type"`
	Flags             *MessageFlags        `json:"flags"`
	MessageReference  *MessageReference    `json:"message_reference,omitempty"`
	Interaction       *MessageInteraction  `json:"message_interaction,omitempty"`
	WebhookID         *Snowflake           `json:"webhook_id,omitempty"`
	Activity          *MessageActivity     `json:"activity,omitempty"`
	Application       *MessageApplication  `json:"application,omitempty"`
	Stickers          []*MessageSticker    `json:"stickers,omitempty"`
	ReferencedMessage *Message             `json:"referenced_message,omitempty"`
	LastUpdated       *time.Time
}

Message is a struct for messages sent in discord text-based channels

func (*Message) AddReaction

func (m *Message) AddReaction(emoji string) error

AddReaction allows you to add a reaction to a message_events from a string, for example a custom emoji ID, or a native emoji

func (*Message) AddReactionByEmote

func (m *Message) AddReactionByEmote(emote Emote) error

AddReactionByEmote allows you to add an Emote to a message_events via reaction

func (*Message) Channel

func (m *Message) Channel() *MessageChannel

Channel gets the channel the message_events was sent in

func (*Message) Crosspost added in v0.2.0

func (m *Message) Crosspost() (*Message, error)

Crosspost crossposts an existing message

func (*Message) Delete added in v0.2.0

func (m *Message) Delete() error

Delete allows you to edit an existing Message sent by you

func (*Message) Edit added in v0.2.0

func (m *Message) Edit(message *MessageUpdate) (*Message, error)

Edit allows you to edit an existing Message sent by you

func (*Message) Guild

func (m *Message) Guild() *Guild

Guild gets the guild_events the message_events was sent in

func (*Message) Reply

func (m *Message) Reply(message *MessageCreate) (*Message, error)

Reply allows you to reply to an existing Message

type MessageActivity added in v0.2.0

type MessageActivity struct {
	Type    MessageActivityType `json:"type"`
	PartyID *string             `json:"party_id,omitempty"`
}

MessageActivity is used for rich presence-related chat embeds in a Message

type MessageActivityType added in v0.2.0

type MessageActivityType int

MessageActivityType is the type of MessageActivity

const (
	MessageActivityTypeJoin MessageActivityType = iota + 1
	MessageActivityTypeSpectate
	MessageActivityTypeListen

	MessageActivityTypeJoinRequest
)

Constants for MessageActivityType

type MessageApplication added in v0.2.0

type MessageApplication struct {
	ID          Snowflake `json:"id"`
	CoverImage  *string   `json:"cover_image,omitempty"`
	Description string    `json:"description"`
	Icon        *string   `json:"icon,omitempty"`
	Name        string    `json:"name"`
}

MessageApplication is used for rich presence-related chat embeds in a Message

type MessageAttachment added in v0.2.0

type MessageAttachment struct {
	ID       Snowflake `json:"id,omitempty"`
	Filename string    `json:"filename"`
	Size     int       `json:"size"`
	URL      string    `json:"url"`
	ProxyURL string    `json:"proxy_url"`
	Height   *int      `json:"height"`
	Width    *int      `json:"width"`
}

MessageAttachment is used for files sent in a Message

type MessageBuilder

type MessageBuilder struct {
	MessageCreate
}

MessageBuilder helper to build Message(s) easier

func NewMessageBuilder

func NewMessageBuilder() *MessageBuilder

NewMessageBuilder creates a new MessageBuilder to be built later

func NewMessageBuilderWithContent added in v0.3.0

func NewMessageBuilderWithContent(content string) *MessageBuilder

NewMessageBuilderWithContent creates a new MessageBuilder with a content to be built later

func NewMessageBuilderWithEmbed added in v0.3.0

func NewMessageBuilderWithEmbed(embed *Embed) *MessageBuilder

NewMessageBuilderWithEmbed creates a new MessageBuilder with an Embed to be built later

func (*MessageBuilder) Build

func (b *MessageBuilder) Build() *MessageCreate

Build builds the MessageBuilder to a MessageCreate struct

func (*MessageBuilder) ClearAllowedMentions added in v0.3.0

func (b *MessageBuilder) ClearAllowedMentions() *MessageBuilder

ClearAllowedMentions clears the allowed mentions of the Message

func (*MessageBuilder) SetAllowedMentions

func (b *MessageBuilder) SetAllowedMentions(allowedMentions *AllowedMentions) *MessageBuilder

SetAllowedMentions sets the AllowedMentions of the Message

func (*MessageBuilder) SetContent

func (b *MessageBuilder) SetContent(content string) *MessageBuilder

SetContent sets content of the Message

func (*MessageBuilder) SetContentf added in v0.3.0

func (b *MessageBuilder) SetContentf(content string, a ...interface{}) *MessageBuilder

SetContentf sets content of the Message

func (*MessageBuilder) SetEmbed

func (b *MessageBuilder) SetEmbed(embed *Embed) *MessageBuilder

SetEmbed sets the Embed of the Message

func (*MessageBuilder) SetMessageReference

func (b *MessageBuilder) SetMessageReference(messageReference *MessageReference) *MessageBuilder

SetMessageReference allows you to specify a MessageReference to reply to

func (*MessageBuilder) SetMessageReferenceByMessageID

func (b *MessageBuilder) SetMessageReferenceByMessageID(messageID Snowflake) *MessageBuilder

SetMessageReferenceByMessageID allows you to specify a Message ID to reply to

func (*MessageBuilder) SetTTS

func (b *MessageBuilder) SetTTS(tts bool) *MessageBuilder

SetTTS sets the text to speech of the Message

type MessageBulkDelete added in v0.2.0

type MessageBulkDelete struct {
	Messages []Snowflake `json:"messages"`
}

MessageBulkDelete is used to bulk delete Message(s)

type MessageCachePolicy

type MessageCachePolicy func(*Message) bool

MessageCachePolicy can be used to define your own policy for caching messages

var (
	MessageCachePolicyNone    MessageCachePolicy = func(_ *Message) bool { return false }
	MessageCachePolicyDefault                    = MessageCachePolicyNone
)

Default member cache policies

func MessageCachePolicyAll

func MessageCachePolicyAll(policy MessageCachePolicy, policies ...MessageCachePolicy) MessageCachePolicy

MessageCachePolicyAll is a shorthand for MessageCachePolicy.And(MessageCachePolicy).And(MessageCachePolicy) etc.

func MessageCachePolicyAny

func MessageCachePolicyAny(policy MessageCachePolicy, policies ...MessageCachePolicy) MessageCachePolicy

MessageCachePolicyAny is a shorthand for MessageCachePolicy.Or(MessageCachePolicy).Or(MessageCachePolicy) etc.

func MessageCachePolicyDuration

func MessageCachePolicyDuration(duration time.Duration) MessageCachePolicy

MessageCachePolicyDuration creates a new MessageCachePolicy which caches messages for the give duration

func (MessageCachePolicy) And

And allows you to require both policies to be true for the member to be cached

func (MessageCachePolicy) Or

Or allows you to combine that policy with another, meaning either needs to be true

type MessageChannel

type MessageChannel struct {
	Channel
}

MessageChannel is used for sending Message(s) to User(s)

func (MessageChannel) BulkDeleteMessages added in v0.2.0

func (c MessageChannel) BulkDeleteMessages(messageIDs ...Snowflake) error

BulkDeleteMessages allows you bulk delete Message(s)

func (MessageChannel) CrosspostMessage added in v0.2.0

func (c MessageChannel) CrosspostMessage(messageID Snowflake) (*Message, error)

CrosspostMessage crossposts an existing Message

func (MessageChannel) DeleteMessage added in v0.2.0

func (c MessageChannel) DeleteMessage(messageID Snowflake) error

DeleteMessage allows you to edit an existing Message sent by you

func (MessageChannel) EditMessage added in v0.2.0

func (c MessageChannel) EditMessage(messageID Snowflake, message *MessageUpdate) (*Message, error)

EditMessage edits a Message in this TextChannel

func (MessageChannel) SendMessage

func (c MessageChannel) SendMessage(message *MessageCreate) (*Message, error)

SendMessage sends a Message to a TextChannel

type MessageCreate

type MessageCreate struct {
	Content          *string           `json:"content,omitempty"`
	TTS              *bool             `json:"tts,omitempty"`
	Embed            *Embed            `json:"embed,omitempty"`
	AllowedMentions  *AllowedMentions  `json:"allowed_mentions,omitempty"`
	MessageReference *MessageReference `json:"message_reference,omitempty"`
}

MessageCreate is the struct to create a new Message with

type MessageFlags

type MessageFlags int64

The MessageFlags of a Message

const (
	MessageFlagNone        MessageFlags = 0
	MessageFlagCrossposted MessageFlags = 1 << (iota - 1)
	MessageFlagIsCrosspost
	MessageFlagSuppressEmbeds
	MessageFlagSourceMessageDeleted
	MessageFlagUrgent

	MessageFlagEphemeral
	MessageFlagLoading // Message is an interaction of type 5, awaiting further response
)

Constants for MessageFlags

func (MessageFlags) Add

func (f MessageFlags) Add(bits ...MessageFlags) *MessageFlags

Add allows you to add multiple bits together, producing a new bit

func (MessageFlags) Has

func (f MessageFlags) Has(bit MessageFlags) bool

Has will check whether the Bit contains another bit

func (MessageFlags) HasAll

func (f MessageFlags) HasAll(bits ...MessageFlags) bool

HasAll will ensure that the bit includes all of the bits entered

func (MessageFlags) Missing

func (f MessageFlags) Missing(bit MessageFlags) bool

Missing will do the inverse of Bit.Has

func (MessageFlags) MissingAny

func (f MessageFlags) MissingAny(bits ...MessageFlags) bool

MissingAny will check whether the bit is missing any one of the bits

func (MessageFlags) Remove

func (f MessageFlags) Remove(bits ...MessageFlags) *MessageFlags

Remove allows you to subtract multiple bits from the first, producing a new bit

type MessageInteraction

type MessageInteraction struct {
	ID   Snowflake       `json:"id"`
	Type InteractionType `json:"type"`
	Name string          `json:"name"`
	User User            `json:"user"`
}

MessageInteraction is sent on the Message object when the message_events is a response to an interaction

type MessageNotifications

type MessageNotifications int

MessageNotifications indicates whether users receive @ mentions on a new message

const (
	MessageNotificationsAllMessages MessageNotifications = iota
	MessageNotificationsOnlyMentions
)

Constants for MessageNotifications

type MessageReaction added in v0.2.0

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

MessageReaction contains information about the reactions of a message_events

type MessageReference

type MessageReference struct {
	MessageID       *Snowflake `json:"message_id"`
	ChannelID       *Snowflake `json:"channel_id,omitempty"`
	GuildID         *Snowflake `json:"guild_id,omitempty"`
	FailIfNotExists *bool      `json:"fail_if_not_exists,omitempty"`
}

MessageReference is a reference to another message

type MessageSticker added in v0.2.0

type MessageSticker struct {
	ID          Snowflake                `json:"id"`
	PackID      Snowflake                `json:"pack_id"`
	Name        string                   `json:"name"`
	Description string                   `json:"description"`
	Tags        *string                  `json:"tags"`
	FormatType  MessageStickerFormatType `json:"format_type"`
}

MessageSticker is a sticker sent with a Message

type MessageStickerFormatType added in v0.2.0

type MessageStickerFormatType int

MessageStickerFormatType is the Format Type of a MessageSticker

const (
	MessageStickerFormatPNG MessageStickerFormatType = iota + 1
	MessageStickerFormatAPNG
	MessageStickerFormatLottie
)

Constants for MessageStickerFormatType

type MessageType

type MessageType int

The MessageType indicates the Message type

const (
	MessageTypeDefault MessageType = iota
	MessageTypeRecipientAdd
	MessageTypeRecipientRemove
	MessageTypeCall
	MessageTypeChannelNameChange
	MessageTypeChannelIconChange
	ChannelPinnedMessage
	MessageTypeGuildMemberJoin
	MessageTypeUserPremiumGuildSubscription
	MessageTypeUserPremiumGuildSubscriptionTier1
	MMessageTypeUserPremiumGuildSubscriptionTier2
	MessageTypeUserPremiumGuildSubscriptionTier3
	MessageTypeChannelFollowAdd

	MessageTypeGuildDiscoveryDisqualified
	MessageTypeGuildDiscoveryRequalified
	MessageTypeGuildDiscoveryInitialWarning
	MessageTypeGuildDiscoveryFinalWarning

	MessageTypeReply
	MessageTypeApplicationCommand
)

Constants for the MessageType

type MessageUpdate added in v0.2.0

type MessageUpdate struct {
	Content         *string          `json:"content,omitempty"`
	Embed           *Embed           `json:"embed,omitempty"`
	Flags           *MessageFlags    `json:"flags,omitempty"`
	AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"`
}

MessageUpdate is used to edit a Message

type MoveGuildMemberData

type MoveGuildMemberData struct {
	ChannelID *Snowflake `json:"channel_id"`
}

MoveGuildMemberData is used to move a member

type Option added in v0.2.0

type Option struct {
	Resolved *Resolved
	Name     string
	Type     CommandOptionType
	Value    interface{}
}

Option holds info about an Option.Value

func (Option) Bool added in v0.2.0

func (o Option) Bool() bool

Bool returns the Option.Value as bool

func (Option) Category added in v0.2.0

func (o Option) Category() *Category

Category returns the Option.Value as Category

func (Option) Channel added in v0.2.0

func (o Option) Channel() *Channel

Channel returns the Option.Value as Channel

func (Option) GuildChannel added in v0.2.0

func (o Option) GuildChannel() *GuildChannel

GuildChannel returns the Option.Value as GuildChannel

func (Option) Integer added in v0.3.0

func (o Option) Integer() int

Integer returns the Option.Value as int

func (Option) Member added in v0.2.0

func (o Option) Member() *Member

Member returns the Option.Value as Member

func (Option) MessageChannel added in v0.2.0

func (o Option) MessageChannel() *MessageChannel

MessageChannel returns the Option.Value as MessageChannel

func (Option) Role added in v0.2.0

func (o Option) Role() *Role

Role returns the Option.Value as Role

func (Option) Snowflake added in v0.2.0

func (o Option) Snowflake() Snowflake

Snowflake returns the Option.Value as Snowflake

func (Option) StoreChannel added in v0.2.0

func (o Option) StoreChannel() *StoreChannel

StoreChannel returns the Option.Value as StoreChannel

func (Option) String added in v0.2.0

func (o Option) String() string

String returns the Option.Value as string

func (Option) TextChannel added in v0.2.0

func (o Option) TextChannel() *TextChannel

TextChannel returns the Option.Value as TextChannel

func (Option) User added in v0.2.0

func (o Option) User() *User

User returns the Option.Value as User

func (Option) VoiceChannel added in v0.2.0

func (o Option) VoiceChannel() *VoiceChannel

VoiceChannel returns the Option.Value as VoiceChannel

type OptionChoice

type OptionChoice struct {
	Name  string      `json:"name"`
	Value interface{} `json:"value"`
}

OptionChoice contains the data for a user using your command

type OptionData

type OptionData struct {
	Name    string            `json:"name"`
	Type    CommandOptionType `json:"type"`
	Value   interface{}       `json:"value,omitempty"`
	Options []*OptionData     `json:"options,omitempty"`
}

OptionData is used for options or subcommands in your slash commands

type Options

type Options struct {
	Logger                    log.Logger
	Intents                   Intents
	RestTimeout               int
	EnableWebhookInteractions bool
	ListenPort                int
	ListenURL                 string
	PublicKey                 string
	LargeThreshold            int
	RawGatewayEventsEnabled   bool
	HTTPClient                *http.Client
}

Options is the configuration used when creating the client

type PermissionOverwrite added in v0.2.0

type PermissionOverwrite struct {
	ID    Snowflake               `json:"id"`
	Type  PermissionOverwriteType `json:"type"`
	Allow Permissions             `json:"allow"`
	Deny  Permissions             `json:"deny"`
}

PermissionOverwrite is used to determine who can perform particular actions in a GuildChannel

type PermissionOverwriteType added in v0.2.0

type PermissionOverwriteType int

PermissionOverwriteType is the type of a PermissionOverwrite

const (
	PermissionOverwriteTypeRole PermissionOverwriteType = iota
	PermissionOverwriteTypeMember
)

Constants for PermissionOverwriteType

type Permissions

type Permissions int64

Permissions extends the Bit structure, and is used within roles and channels

const (
	PermissionSendMessages Permissions = 1 << (iota + 11)
	PermissionSendTTSMessages
	PermissionManageMessages
	PermissionEmbedLinks
	PermissionAttachFiles
	PermissionReadMessageHistory
	PermissionMentionEveryone
	PermissionUseExternalEmojis
)

Constants for the different bit offsets of text channel permissions

const (
	PermissionVoiceConnect Permissions = 1 << (iota + 20)
	PermissionVoiceSpeak
	PermissionVoiceMuteMembers
	PermissionVoiceDeafenMembers
	PermissionVoiceMoveMembers
	PermissionVoiceUseVAD
	PermissionVoicePrioritySpeaker Permissions = 1 << (iota + 2)
)

Constants for the different bit offsets of voice permissions

const (
	PermissionChangeNickname Permissions = 1 << (iota + 26)
	PermissionManageNicknames
	PermissionManageRoles
	PermissionManageWebhooks
	PermissionManageEmojis
	PermissionUseSlashCommands
)

Constants for general management.

func (Permissions) Add

func (p Permissions) Add(bits ...Bit) Bit

Add allows you to add multiple bits together, producing a new bit

func (Permissions) Has

func (p Permissions) Has(bit Bit) bool

Has will check whether the Bit contains another bit

func (Permissions) HasAll

func (p Permissions) HasAll(bits ...Bit) bool

HasAll will ensure that the bit includes all of the bits entered

func (Permissions) MarshalJSON

func (p Permissions) MarshalJSON() ([]byte, error)

MarshalJSON marshals permissions into a string

func (Permissions) Missing

func (p Permissions) Missing(bit Bit) bool

Missing will do the inverse of Bit.Has

func (Permissions) MissingAny

func (p Permissions) MissingAny(bits ...Bit) bool

MissingAny will check whether the bit is missing any one of the bits

func (Permissions) Remove

func (p Permissions) Remove(bits ...Bit) Bit

Remove allows you to subtract multiple bits from the first, producing a new bit

func (*Permissions) UnmarshalJSON

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

UnmarshalJSON unmarshals permissions into an int64

type PremiumTier

type PremiumTier int

PremiumTier tells you the boost level of a guild

const (
	PremiumTierNone PremiumTier = iota
	PremiumTier1
	PremiumTier2
	PremiumTier3
)

Constants for PremiumTier

type RawGatewayEvent added in v0.2.0

type RawGatewayEvent struct {
	GatewayPacket
	D json.RawMessage `json:"d"`
}

RawGatewayEvent specifies the data for the GatewayCommand payload that is being sent

type ReadyGatewayEvent

type ReadyGatewayEvent struct {
	Version   int      `json:"v"`
	SelfUser  User     `json:"user"`
	Guilds    []*Guild `json:"guilds"`
	SessionID string   `json:"session_id"`
	Shard     *[2]int  `json:"shard,omitempty"`
}

ReadyGatewayEvent is the event sent by discord when you successfully Identify

type RequestGuildMembersCommand

type RequestGuildMembersCommand struct {
	GuildID   Snowflake   `json:"guild_id"`
	Query     string      `json:"query"` //If specified, user_ids must not be entered
	Limit     int         `json:"limit"` //Must be >=1 if query/user_ids is used, otherwise 0
	Presences bool        `json:"presences,omitempty"`
	UserIDs   []Snowflake `json:"user_ids"`        //If specified, query must not be entered
	Nonce     string      `json:"nonce,omitempty"` //All responses are hashed with this nonce, optional
}

RequestGuildMembersCommand is used for fetching all of the members of a guild_events. It is recommended you have a strict member caching policy when using this.

type Resolved

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

Resolved contains resolved mention data

type RestClient

type RestClient interface {
	Close()
	Disgo() Disgo

	UserAgent() string
	Request(route *endpoints.CompiledAPIRoute, rqBody interface{}, rsBody interface{}) error

	SendMessage(channelID Snowflake, message *MessageCreate) (*Message, error)
	EditMessage(channelID Snowflake, messageID Snowflake, message *MessageUpdate) (*Message, error)
	DeleteMessage(channelID Snowflake, messageID Snowflake) error
	BulkDeleteMessages(channelID Snowflake, messageIDs ...Snowflake) error
	CrosspostMessage(channelID Snowflake, messageID Snowflake) (*Message, error)

	OpenDMChannel(userID Snowflake) (*DMChannel, error)

	UpdateSelfNick(guildID Snowflake, nick *string) (*string, error)

	GetUser(userID Snowflake) (*User, error)
	GetMember(guildID Snowflake, userID Snowflake) (*Member, error)
	GetMembers(guildID Snowflake) ([]*Member, error)
	AddMember(guildID Snowflake, userID Snowflake, addGuildMemberData *AddGuildMemberData) (*Member, error)
	KickMember(guildID Snowflake, userID Snowflake, reason *string) error
	UpdateMember(guildID Snowflake, userID Snowflake, updateGuildMemberData *UpdateGuildMemberData) (*Member, error)
	MoveMember(guildID Snowflake, userID Snowflake, channelID *Snowflake) (*Member, error)
	AddMemberRole(guildID Snowflake, userID Snowflake, roleID Snowflake) error
	RemoveMemberRole(guildID Snowflake, userID Snowflake, roleID Snowflake) error

	GetRoles(guildID Snowflake) ([]*Role, error)
	CreateRole(guildID Snowflake, role *UpdateRole) (*Role, error)
	UpdateRole(guildID Snowflake, roleID Snowflake, role *UpdateRole) (*Role, error)
	UpdateRolePositions(guildID Snowflake, roleUpdates ...*UpdateRolePosition) ([]*Role, error)
	DeleteRole(guildID Snowflake, roleID Snowflake) error

	AddReaction(channelID Snowflake, messageID Snowflake, emoji string) error
	RemoveOwnReaction(channelID Snowflake, messageID Snowflake, emoji string) error
	RemoveUserReaction(channelID Snowflake, messageID Snowflake, emoji string, userID Snowflake) error

	GetGlobalCommands(applicationID Snowflake) ([]*Command, error)
	GetGlobalCommand(applicationID Snowflake, commandID Snowflake) (*Command, error)
	CreateGlobalCommand(applicationID Snowflake, command *CommandCreate) (*Command, error)
	SetGlobalCommands(applicationID Snowflake, commands ...*CommandCreate) ([]*Command, error)
	EditGlobalCommand(applicationID Snowflake, commandID Snowflake, command *CommandUpdate) (*Command, error)
	DeleteGlobalCommand(applicationID Snowflake, commandID Snowflake) error

	GetGuildCommands(applicationID Snowflake, guildID Snowflake) ([]*Command, error)
	GetGuildCommand(applicationID Snowflake, guildID Snowflake, commandID Snowflake) (*Command, error)
	CreateGuildCommand(applicationID Snowflake, guildID Snowflake, command *CommandCreate) (*Command, error)
	SetGuildCommands(applicationID Snowflake, guildID Snowflake, commands ...*CommandCreate) ([]*Command, error)
	EditGuildCommand(applicationID Snowflake, guildID Snowflake, commandID Snowflake, command *CommandUpdate) (*Command, error)
	DeleteGuildCommand(applicationID Snowflake, guildID Snowflake, commandID Snowflake) error

	GetGuildCommandsPermissions(applicationID Snowflake, guildID Snowflake) ([]*GuildCommandPermissions, error)
	GetGuildCommandPermissions(applicationID Snowflake, guildID Snowflake, commandID Snowflake) (*GuildCommandPermissions, error)
	SetGuildCommandsPermissions(applicationID Snowflake, guildID Snowflake, commandPermissions ...*SetGuildCommandPermissions) ([]*GuildCommandPermissions, error)
	SetGuildCommandPermissions(applicationID Snowflake, guildID Snowflake, commandID Snowflake, commandPermissions *SetGuildCommandPermissions) (*GuildCommandPermissions, error)

	SendInteractionResponse(interactionID Snowflake, interactionToken string, interactionResponse *InteractionResponse) error
	EditInteractionResponse(applicationID Snowflake, interactionToken string, followupMessage *FollowupMessage) (*Message, error)
	DeleteInteractionResponse(applicationID Snowflake, interactionToken string) error

	SendFollowupMessage(applicationID Snowflake, interactionToken string, followupMessage *FollowupMessage) (*Message, error)
	EditFollowupMessage(applicationID Snowflake, interactionToken string, messageID Snowflake, followupMessage *FollowupMessage) (*Message, error)
	DeleteFollowupMessage(applicationID Snowflake, interactionToken string, followupMessageID Snowflake) error
}

RestClient is a manager for all of disgo's HTTP requests

type ResumeCommand

type ResumeCommand struct {
	Token     string `json:"token"`
	SessionID string `json:"session_id"`
	Seq       int    `json:"seq"`
}

ResumeCommand is used to resume a connection to discord in the case that you are disconnected. Is automatically handled by the library and should rarely be used.

type Role

type Role struct {
	Disgo       Disgo
	GuildID     Snowflake
	ID          Snowflake   `json:"id"`
	Name        string      `json:"name"`
	Color       Color       `json:"color"`
	Hoist       bool        `json:"hoist"`
	Position    int         `json:"position"`
	Permissions Permissions `json:"permissions"`
	Managed     bool        `json:"managed"`
	Mentionable bool        `json:"mentionable"`
	Tags        *RoleTag    `json:"tags,omitempty"`
}

Role is a Guild Role object

func (Role) Delete

func (r Role) Delete() error

Delete deletes the Role

func (Role) Guild

func (r Role) Guild() *Guild

Guild returns the Guild of this role from the Cache

func (Role) Mention

func (r Role) Mention() string

Mention parses the Role as a Mention

func (Role) SetPosition

func (r Role) SetPosition(rolePositionUpdate *UpdateRolePosition) ([]*Role, error)

SetPosition sets the position of the Role

func (Role) String

func (r Role) String() string

String parses the Role to a String representation

func (Role) Update

func (r Role) Update(roleUpdate *UpdateRole) (*Role, error)

Update updates the Role with specific values

type RoleTag

type RoleTag struct {
	BotID             *Snowflake `json:"bot_id,omitempty"`
	IntegrationID     *Snowflake `json:"integration_id,omitempty"`
	PremiumSubscriber bool       `json:"premium_subscriber"`
}

RoleTag are tags a Role has

type SetGuildCommandPermissions added in v0.2.0

type SetGuildCommandPermissions struct {
	ID          Snowflake            `json:"id,omitempty"`
	Permissions []*CommandPermission `json:"permissions"`
}

SetGuildCommandPermissions is used to update CommandPermission ID should be omitted fro bulk update

type SetGuildCommandsPermissions added in v0.2.0

type SetGuildCommandsPermissions []*SetGuildCommandPermissions

SetGuildCommandsPermissions holds a slice of SetGuildCommandPermissions

type Snowflake

type Snowflake string

Snowflake is a general utility class around discord's IDs

func (Snowflake) Binary

func (s Snowflake) Binary() string

Binary converts the snowflake to binary

func (Snowflake) Deconstruct

func (s Snowflake) Deconstruct() DeconstructedSnowflake

Deconstruct returns DeconstructedSnowflake

func (Snowflake) String

func (s Snowflake) String() string

func (Snowflake) Timestamp

func (s Snowflake) Timestamp() time.Time

Timestamp returns a Time value of the snowflake

type StoreChannel

type StoreChannel struct {
	GuildChannel
}

StoreChannel allows you to interact with discord's store channels

type SystemChannelFlag

type SystemChannelFlag int

SystemChannelFlag contains the settings for the guilds system channel

const (
	SystemChannelFlagSuppressJoinNotifications SystemChannelFlag = 1 << iota
	SystemChannelFlagSuppressPremiumSubscriptions
)

Constants for SystemChannelFlag

type TargetType added in v0.2.0

type TargetType int

TargetType is type of target an Invite uses

const (
	TargetTypeStream TargetType = iota + 1
	TargetTypeEmbeddedApplication
)

Constants for TargetType

type TextChannel

type TextChannel struct {
	GuildChannel
	MessageChannel
}

TextChannel allows you to interact with discord's text channels

type UpdateGuildMemberData

type UpdateGuildMemberData struct {
	Nick  *string     `json:"nick,omitempty"`
	Roles []Snowflake `json:"roles,omitempty"`
	Mute  *bool       `json:"mute,omitempty"`
	Deaf  *bool       `json:"deaf,omitempty"`
}

UpdateGuildMemberData is used to modify

type UpdateRole

type UpdateRole struct {
	Name        *string      `json:"name,omitempty"`
	Permissions *Permissions `json:"permissions,omitempty"`
	Color       *Color       `json:"color,omitempty"`
	Hoist       *bool        `json:"hoist,omitempty"`
	Mentionable *bool        `json:"mentionable,omitempty"`
}

UpdateRole is the payload to update a Role

type UpdateRolePosition

type UpdateRolePosition struct {
	ID       Snowflake `json:"id"`
	Position *int      `json:"position"`
}

UpdateRolePosition is the payload to update a Role(s) position

type UpdateSelfNick

type UpdateSelfNick struct {
	Nick *string `json:"nick"`
}

UpdateSelfNick is used to update your own nick

type UpdateStatusCommand

type UpdateStatusCommand struct {
	Since      *int       `json:"since"`
	Activities []Activity `json:"activities"`
	Status     bool       `json:"status"`
	AFK        bool       `json:"afk"`
}

UpdateStatusCommand is used for updating Disgo's presence

type UpdateVoiceStateCommand

type UpdateVoiceStateCommand struct {
	GuildID   Snowflake  `json:"guild_id"`
	ChannelID *Snowflake `json:"channel_id"`
	SelfMute  bool       `json:"self_mute"`
	SelfDeaf  bool       `json:"self_deaf"`
}

UpdateVoiceStateCommand is used for updating the bots voice state in a guild_events

type User

type User struct {
	Disgo         Disgo
	ID            Snowflake `json:"id"`
	Username      string    `json:"username"`
	Discriminator string    `json:"discriminator"`
	Avatar        *string   `json:"avatar"`
	IsBot         bool      `json:"bot"`
	System        *bool     `json:"system"`
	MfaEnabled    *bool     `json:"mfa_enabled"`
	Locale        *string   `json:"locale"`
	Verified      *bool     `json:"verified"`
	Email         *string   `json:"email"`
	Flags         *int      `json:"flags"`
	PremiumType   *int      `json:"premium_type"`
	PublicFlags   *int      `json:"public_flags"`
}

User is a struct for interacting with discord's users

func (*User) AvatarURL added in v0.3.0

func (u *User) AvatarURL() string

AvatarURL returns the Avatar URL of the User

func (User) Mention

func (u User) Mention() string

Mention returns the user as a mention

func (User) OpenDMChannel

func (u User) OpenDMChannel() (*DMChannel, error)

OpenDMChannel creates a DMChannel between the user and the Disgo client

func (User) String

func (u User) String() string

func (User) Tag

func (u User) Tag() string

Tag returns the user's Username and Discriminator

type VerificationLevel

type VerificationLevel int

The VerificationLevel of a guild that members must be to send messages

const (
	VerificationLevelNone VerificationLevel = iota
	VerificationLevelLow
	VerificationLevelMedium
	VerificationLevelHigh
	VerificationLevelVeryHigh
)

Constants for VerificationLevel

type VoiceChannel

type VoiceChannel struct {
	GuildChannel
}

VoiceChannel adds methods specifically for interacting with discord's voice

func (*VoiceChannel) Connect added in v0.2.0

func (c *VoiceChannel) Connect() error

Connect sends a api.GatewayCommand to connect to this VoiceChannel

type VoiceDispatchInterceptor added in v0.2.0

type VoiceDispatchInterceptor interface {
	OnVoiceServerUpdate(voiceServerUpdateEvent *VoiceServerUpdateEvent)
	OnVoiceStateUpdate(voiceStateUpdateEvent *VoiceStateUpdateEvent)
}

VoiceDispatchInterceptor lets you listen to VoiceServerUpdate & VoiceStateUpdate

type VoiceServerUpdate added in v0.2.0

type VoiceServerUpdate struct {
	Token    string    `json:"token"`
	GuildID  Snowflake `json:"guild_id"`
	Endpoint *string   `json:"endpoint"`
}

VoiceServerUpdate from Discord

type VoiceServerUpdateEvent added in v0.2.0

type VoiceServerUpdateEvent struct {
	VoiceServerUpdate
	Disgo Disgo
}

VoiceServerUpdateEvent sent when a guilds voice server is updated

func (*VoiceServerUpdateEvent) Guild added in v0.2.0

func (u *VoiceServerUpdateEvent) Guild() *Guild

Guild returns the Guild for this VoiceServerUpdate from the Cache

type VoiceState

type VoiceState struct {
	Disgo         Disgo
	GuildID       Snowflake  `json:"guild_id"`
	ChannelID     *Snowflake `json:"channel_id"`
	UserID        Snowflake  `json:"user_id"`
	SessionID     string     `json:"session_id"`
	GuildDeafened bool       `json:"deaf"`
	GuildMuted    bool       `json:"mute"`
	SelfDeafened  bool       `json:"self_deaf"`
	SelfMuted     bool       `json:"self_mute"`
	Stream        bool       `json:"self_stream"`
	Video         bool       `json:"self_video"`
	Suppressed    bool       `json:"suppress"`
}

VoiceState from Discord

func (VoiceState) Deafened added in v0.2.0

func (s VoiceState) Deafened() bool

Deafened returns if the Member is deafened

func (VoiceState) Guild added in v0.2.0

func (s VoiceState) Guild() *Guild

Guild returns the Guild of this VoiceState from the Cache

func (VoiceState) Member

func (s VoiceState) Member() *Member

Member returns the Member of this VoiceState from the Cache

func (VoiceState) Muted added in v0.2.0

func (s VoiceState) Muted() bool

Muted returns if the Member is muted

func (VoiceState) User added in v0.2.0

func (s VoiceState) User() *User

User returns the User of this VoiceState from the Cache

func (VoiceState) VoiceChannel added in v0.2.0

func (s VoiceState) VoiceChannel() *VoiceChannel

VoiceChannel returns the VoiceChannel of this VoiceState from the Cache

type VoiceStateUpdateEvent added in v0.2.0

type VoiceStateUpdateEvent struct {
	*VoiceState
	Member *Member `json:"member"`
}

VoiceStateUpdateEvent sent when someone joins/leaves/moves voice channels

func (*VoiceStateUpdateEvent) Guild added in v0.2.0

func (u *VoiceStateUpdateEvent) Guild() *Guild

Guild returns the Guild for this VoiceStateUpdate from the Cache

func (*VoiceStateUpdateEvent) VoiceChannel added in v0.2.0

func (u *VoiceStateUpdateEvent) VoiceChannel() *VoiceChannel

VoiceChannel returns the VoiceChannel for this VoiceStateUpdate from the Cache

type WebhookEventHandler

type WebhookEventHandler interface {
	EventHandler
	HandleWebhookEvent(disgo Disgo, eventManager EventManager, replyChannel chan interface{}, payload interface{})
}

WebhookEventHandler is used to handle raw webhook events

type WebhookServer

type WebhookServer interface {
	Disgo() Disgo
	PublicKey() ed25519.PublicKey
	ListenURL() string
	Router() *mux.Router
	Start()
	Close()
}

WebhookServer is used for receiving an Interaction over http

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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