Documentation ¶
Index ¶
- Variables
- type BaseCommand
- type Bot
- type ChatCommands
- type ChatContext
- func (c *ChatContext) Channel(ctx context.Context) (*harmony.Channel, error)
- func (c *ChatContext) Guild(ctx context.Context) (*harmony.Guild, error)
- func (c *ChatContext) LogError(msg string, err error, fields ...zapcore.Field)
- func (c *ChatContext) LogErrorWithGuild(msg string, err error, guildID string, fields ...zapcore.Field)
- func (c *ChatContext) Member(ctx context.Context) (*harmony.GuildMember, error)
- func (c *ChatContext) Reply(ctx context.Context, msg string, args ...interface{}) error
- func (c *ChatContext) ReplyEmbed(ctx context.Context, embed *embed.Embed, msg string, args ...interface{}) error
- func (c *ChatContext) ReplyWithEmoji(ctx context.Context, emojiName string, msg string, args ...interface{}) error
- func (c *ChatContext) Username(discrim bool) string
- type Options
Constants ¶
This section is empty.
Variables ¶
var ( ErrPrefixLength = errors.New("bot: prefix cannot be greater than a character in length") ErrDBNil = errors.New("bot: the provided database is nil") )
Errors returned by the bot during initialization
Functions ¶
This section is empty.
Types ¶
type BaseCommand ¶
type BaseCommand interface {
Permissions() int
}
BaseCommand is a basis for all Commands.
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
Bot is a Discord bot backed by Harmony.
func (*Bot) ChangeActivity ¶
ChangeActivity changes the Bot's Discord activity.
type ChatCommands ¶
type ChatCommands struct { Help helpCmd `cmd:"" help:"Get help with a command"` Version versionCmd `cmd:"" help:"Print the current bot version"` Jerkcity jerkcityCmd `cmd:"" help:"Slurping and drooling and hurrrr"` Pronouns pronounsCmd `cmd:"" help:"Generate pronoun roles for your guild"` }
ChatCommands are default Commands provided by the bot.
type ChatContext ¶
ChatContext is supplied to Commands upon execution.
func (*ChatContext) LogError ¶
func (c *ChatContext) LogError(msg string, err error, fields ...zapcore.Field)
LogError logs an error to the internal Bot's logger.
func (*ChatContext) LogErrorWithGuild ¶
func (c *ChatContext) LogErrorWithGuild(msg string, err error, guildID string, fields ...zapcore.Field)
LogErrorWithGuild logs an error with a specific Guild ID rather than the Context's own.
func (*ChatContext) Member ¶
func (c *ChatContext) Member(ctx context.Context) (*harmony.GuildMember, error)
Member retrieves the GuildMember that invoked the parent Command.
func (*ChatContext) Reply ¶
func (c *ChatContext) Reply(ctx context.Context, msg string, args ...interface{}) error
Reply sends a message to the parent channel.
func (*ChatContext) ReplyEmbed ¶
func (c *ChatContext) ReplyEmbed(ctx context.Context, embed *embed.Embed, msg string, args ...interface{}) error
ReplyEmbed sends a Rich Embed and optionally a message to the parent channel.
func (*ChatContext) ReplyWithEmoji ¶
func (c *ChatContext) ReplyWithEmoji(ctx context.Context, emojiName string, msg string, args ...interface{}) error
ReplyWithEmoji sends a message as if it were being said by the given emoji (if it exists) to the parent channel.
func (*ChatContext) Username ¶
func (c *ChatContext) Username(discrim bool) string
Username returns the Bot's Discord username, optionally suffixing it with its discriminator.