Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Database ¶
type Database interface { Migrator() Migrator Scheduler() Scheduler Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error) QueryRow(ctx context.Context, sql string, args ...any) pgx.Row Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error) GetContext(ctx context.Context, v any, sql string, args ...any) error SelectContext(ctx context.Context, v any, sql string, args ...any) error Get(v any, sql string, args ...any) error Select(v any, sql string, args ...any) error db.Config }
type Migrator ¶
type Migrator = db.MigratorInterface
type Module ¶
type Module interface { // Name is used for the configuration file (suffixed with .yaml), database schema, and help command. // It should be lowercase. Name() string // Migrations are added to the database's Migrator. // nil if the module has no migrations. Migrations() migrate.MigrationSource // Setup is used to register aliases, handlers etc. // Most modules can just use Commands, AppCommands, Handlers, and EventTypes instead. Setup() error // Ready is called *in a separate goroutine* when the bot receives its first ready event Ready() // TODO: replace with slice of command structs Commands() []any // List of application commands to register with Discord AppCommands() []api.CreateCommandData // List of handlers to add to the bot Handlers() []any // EventTypes are registered to the database's Scheduler EventTypes() []db.Event // contains filtered or unexported methods }
Module is a module. It must embed ModuleBase in this package.
Modules may also implement the following other interfaces: - HasConfig
type ModuleBase ¶
type ModuleBase struct {
*Bot
}
ModuleBase is the base for a module. It must be embedded into bot module types (usually called "Module" as well)
func (*ModuleBase) AppCommands ¶
func (*ModuleBase) AppCommands() []api.CreateCommandData
func (*ModuleBase) Commands ¶
func (*ModuleBase) Commands() []any
func (*ModuleBase) EventTypes ¶
func (*ModuleBase) EventTypes() []db.Event
func (*ModuleBase) Handlers ¶
func (*ModuleBase) Handlers() []any
func (*ModuleBase) Migrations ¶
func (*ModuleBase) Migrations() migrate.MigrationSource
Methods that modules can override, defined here so that unused methods don't have to be added to modules.
func (*ModuleBase) Ready ¶
func (*ModuleBase) Ready()
func (*ModuleBase) Setup ¶
func (*ModuleBase) Setup() error
type Scheduler ¶
type Scheduler = db.SchedulerInterface
type SchedulerBot ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.