Documentation ¶
Index ¶
- Variables
- type Config
- type DiscordBot
- func (d *DiscordBot) API() *jsonapi.DiscordJSONClient
- func (d *DiscordBot) AuthenticateAndConnect() error
- func (d *DiscordBot) Config() Config
- func (d *DiscordBot) DiffAndRegisterSlashCommands(ctx context.Context) error
- func (d *DiscordBot) Disconnect() error
- func (d *DiscordBot) Dispatcher() Dispatcher
- func (d *DiscordBot) Intents() int
- func (d *DiscordBot) LastSequence() int
- func (d *DiscordBot) ReconfigureHeartbeat(ctx context.Context, interval int)
- func (d *DiscordBot) Run(ctx context.Context) error
- func (d *DiscordBot) SetDebug(val bool)
- func (d *DiscordBot) UpdateSequence(seq int) bool
- type DispatchHandlerFunc
- type Dispatcher
- type Logger
- type Payload
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDuplicateCommand = errors.New("duplicate command")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ClientID string ClientSecret string BotToken string APIURL string NumWorkers int OS string BotName string BotPresence string UseSlashCommands bool GlobalSlashCommands []jsonapi.ApplicationCommand GuildSlashCommands map[snowflake.Snowflake][]jsonapi.ApplicationCommand }
Config is the set of configuration options for creating a DiscordBot with NewDiscordBot
type DiscordBot ¶
type DiscordBot struct {
// contains filtered or unexported fields
}
func NewDiscordBot ¶
func NewDiscordBot(deps dependencies, conf Config, permissions, intents int) *DiscordBot
NewDiscordBot creates a new DiscordBot
func (*DiscordBot) API ¶
func (d *DiscordBot) API() *jsonapi.DiscordJSONClient
func (*DiscordBot) AuthenticateAndConnect ¶
func (d *DiscordBot) AuthenticateAndConnect() error
func (*DiscordBot) Config ¶
func (d *DiscordBot) Config() Config
func (*DiscordBot) DiffAndRegisterSlashCommands ¶
func (d *DiscordBot) DiffAndRegisterSlashCommands(ctx context.Context) error
func (*DiscordBot) Disconnect ¶
func (d *DiscordBot) Disconnect() error
func (*DiscordBot) Dispatcher ¶
func (d *DiscordBot) Dispatcher() Dispatcher
func (*DiscordBot) Intents ¶
func (d *DiscordBot) Intents() int
func (*DiscordBot) LastSequence ¶
func (d *DiscordBot) LastSequence() int
func (*DiscordBot) ReconfigureHeartbeat ¶
func (d *DiscordBot) ReconfigureHeartbeat(ctx context.Context, interval int)
func (*DiscordBot) SetDebug ¶
func (d *DiscordBot) SetDebug(val bool)
func (*DiscordBot) UpdateSequence ¶
func (d *DiscordBot) UpdateSequence(seq int) bool
type DispatchHandlerFunc ¶
type DispatchHandlerFunc = func(Payload, wsapi.WSMessage, chan<- wsapi.WSMessage) snowflake.Snowflake
DispatcherFunc is the api that a bot expects a handler function to have
type Dispatcher ¶
type Dispatcher interface { ConnectToBot(*DiscordBot) GenerateHeartbeat(context.Context, int) (wsapi.WSMessage, error) AddHandler(string, DispatchHandlerFunc) HandleRequest(wsapi.WSMessage, chan<- wsapi.WSMessage) snowflake.Snowflake }
Dispatcher is the api that a bot expects a handler manager to have
Click to show internal directories.
Click to hide internal directories.