dbot

package
v0.0.0-...-e22a1a7 Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var B = &Bot{}

B is the bot instance. It is called B to avoid interference with DisGo's wavy package.

Functions

func LoadConfig

func LoadConfig()

LoadConfig loads the configuration from the environment variables.

Types

type Bot

type Bot struct {
	// StartedAt is when the bot started.
	StartedAt time.Time
	// GoVersion is the version of Go the bot uses.
	GoVersion string
	// Client is the Discord client for the bot.
	Client bot.Client
	// Paginator is the paginator the bot uses.
	Paginator *paginator.Manager
	// Lavalink is the Lavalink struct for the bot.
	Lavalink models.Lavalink
	// Logger is the logger the bot uses.
	Logger *log.Logger
	// Version is the version of the bot.
	Version string
}

Bot contains all the variables that are used throughout the bot.

func (*Bot) AddLavalinkNodes

func (b *Bot) AddLavalinkNodes(ctx context.Context) (nodes []disgolink.Node, err error)

AddLavalinkNodes adds all the Lavalink nodes from the lavalink.json file to the Lavalink client.

func (*Bot) GetAvatar

func (b *Bot) GetAvatar(opts ...discord.CDNOpt) string

GetAvatar returns the bot's avatar.

func (b *Bot) GetInviteLink() string

GetInviteLink returns the bot's invite link.

func (*Bot) GetStats

func (b *Bot) GetStats() (version string, goVersion string, disGoVersion string, disGoLinkVersion string, uptime time.Duration, shards int, guilds int, channels int)

GetStats returns the bot's stats. TODO(Robert): Voice connections?

func (*Bot) OnPlayerPause

func (b *Bot) OnPlayerPause(player disgolink.Player, event lavalink.PlayerPauseEvent)

func (*Bot) OnPlayerResume

func (b *Bot) OnPlayerResume(player disgolink.Player, event lavalink.PlayerResumeEvent)

func (*Bot) OnReady

func (b *Bot) OnReady(event *events.Ready)

OnReady is called when the client is done preparing the data received from Discord.

func (*Bot) OnTrackEnd

func (b *Bot) OnTrackEnd(player disgolink.Player, event lavalink.TrackEndEvent)

func (*Bot) OnTrackException

func (b *Bot) OnTrackException(player disgolink.Player, event lavalink.TrackExceptionEvent)

func (*Bot) OnTrackStart

func (b *Bot) OnTrackStart(player disgolink.Player, event lavalink.TrackStartEvent)

func (*Bot) OnTrackStuck

func (b *Bot) OnTrackStuck(player disgolink.Player, event lavalink.TrackStuckEvent)

func (*Bot) OnVoiceServerUpdate

func (b *Bot) OnVoiceServerUpdate(event *events.VoiceServerUpdate)

func (*Bot) OnVoiceStateUpdate

func (b *Bot) OnVoiceStateUpdate(event *events.GuildVoiceStateUpdate)

func (*Bot) OnWebSocketClosed

func (b *Bot) OnWebSocketClosed(player disgolink.Player, event lavalink.WebSocketClosedEvent)

func (*Bot) Setup

func (b *Bot) Setup(listeners ...bot.EventListener) (err error)

Setup sets up the bot.

type Configuration

type Configuration struct {
	// Debug is the debug mode of the bot.
	Debug bool `env:"DEBUG" envDefault:"false"`

	// Token is the token of the bot, this is used to authenticate with the Discord API.
	Token string `env:"TOKEN"`
	// AdminGuild is the guild ID of the admin guild, this is used to test slash commands without pushing them to all guilds.
	AdminGuild snowflake.ID `env:"ADMIN_GUILD" envDefault:""`
	// InvitePermissions is the permissions integer that is used when generating the invite link.
	// @TODO(Robert): Calculate permissions, admin perms are definitely not needed and are a security risk.
	InvitePermissions int `env:"INVITE_PERMISSIONS" envDefault:"8"`
	// SupportServerURL is the URL of the support server.
	SupportServerURL string `env:"SUPPORT_SERVER_URL" envDefault:"https://discord.wavybot.com"`

	// EmbColour is the colour of the embeds. This is a hex value, converted to an int with base 16.
	EmbColour int `env:"EMB_COLOUR" envDefault:"790311"`
	// EmbColourError is the colour of the error embeds. This is a hex value, converted to an int with base 16.
	EmbErrColour int `env:"EMB_ERR_COLOUR" envDefault:"16399360"`

	// SentryURL is the URL of the Sentry instance.
	SentryURL string `env:"SENTRY_URL"`
}

Configuration contains the configuration values for the bot.

var Config *Configuration

Config is the global configuration struct.

Jump to

Keyboard shortcuts

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