Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrResponse = errors.New("error response")
ErrResponse is the error that is wrapped and returned when there is a non-200 api response
Functions ¶
This section is empty.
Types ¶
type BotConfig ¶
type BotConfig struct { ClientID string ClientSecret string BotToken string APIURL string NumWorkers int OS string BotName string BotPresence string }
BotConfig is the set of configuration options for creating a DiscordBot with NewDiscordBot
type DiscordBot ¶
type DiscordBot interface { AuthenticateAndConnect() error Disconnect() error Run(context.Context) error AddMessageHandler(event string, handler DiscordMessageHandlerFunc) SendMessage(context.Context, snowflake.Snowflake, json.Marshaler) (*http.Response, []byte, error) UpdateSequence(int) bool ReconfigureHeartbeat(context.Context, int) LastSequence() int Config() BotConfig }
DiscordBot is the api for a discord bot object
func NewDiscordBot ¶
func NewDiscordBot(deps dependencies, conf BotConfig) DiscordBot
NewDiscordBot creates a new DiscordBot
type DiscordMessageHandler ¶
type DiscordMessageHandler interface { ConnectToBot(DiscordBot) AddHandler(string, DiscordMessageHandlerFunc) HandleRequest(wsclient.WSMessage, chan<- wsclient.WSMessage) }
DiscordMessageHandler is the api that a bot expects a handler manager to have
Click to show internal directories.
Click to hide internal directories.