bot

package
v20.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: MIT Imports: 19 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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
}

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() *json.DiscordJSONClient

func (*DiscordBot) AuthenticateAndConnect

func (d *DiscordBot) AuthenticateAndConnect() error

func (*DiscordBot) Config

func (d *DiscordBot) Config() Config

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

func (d *DiscordBot) Run(ctx context.Context) error

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

type Logger

type Logger = interface {
	Log(keyvals ...interface{}) error
	Message(string, ...interface{})
	Err(string, error, ...interface{})
	Printf(string, ...interface{})
}

type Payload

type Payload = interface {
	EventName() string
	Contents() map[string]etf.Element
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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