Version: v0.20.0 Latest Latest

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

Go to latest
Published: Aug 10, 2021 License: BSD-3-Clause Imports: 6 Imported by: 6



Package bot provides a basic embeddable Bot struct for more easily handling commands



This section is empty.


This section is empty.


This section is empty.


type Bot

type Bot struct {
	Router *bcr.Router

	Modules []Module

Bot is the main bot struct

func New

func New(token string) (*Bot, error)

New creates a new instance of Bot. The token will be prefixed with `Bot ` automatically.

func NewWithRouter

func NewWithRouter(r *bcr.Router) *Bot

NewWithRouter creates a new bot with the given router

func (*Bot) Add

func (bot *Bot) Add(f func(*Bot) (string, []*bcr.Command))

Add adds a module to the bot

func (*Bot) CommandList

func (bot *Bot) CommandList(ctx *bcr.Context) (err error)

CommandList is a command that shows a list of all commands in the bot instance

func (*Bot) Owner

func (bot *Bot) Owner(owners ...discord.UserID)

Owner is a helper function to set the bot's owner(s)

func (*Bot) Prefix

func (bot *Bot) Prefix(prefixes ...string)

Prefix is a helper function to set the bot's router's prefixes

func (*Bot) Start added in v0.11.0

func (bot *Bot) Start(ctx context.Context) error

Start wraps around Router.ShardManager.Open()

type Module

type Module interface {
	String() string
	Commands() []*bcr.Command

Module is a single module/category of commands

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL