command

package
v0.0.0-...-82e9c16 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2020 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CategoryToString

func CategoryToString(in Category) string

CategoryToString converts a Category to the string of the name

Types

type Category

type Category int

Category is an enumeration type of the categories

const (
	// CategoryInfodagen is the category for Infodagen commands
	CategoryInfodagen Category = iota
	// CategoryLinks is the category for link commands
	CategoryLinks Category = iota
	// CategoryAlgemeen is the category for general commands
	CategoryAlgemeen Category = iota
	// CategoryFun is the category for funny commands
	CategoryFun Category = iota
	// CategoryModeratie is the category for moderation commands
	CategoryModeratie Category = iota
	// CategoryStudenten is the category for student commands
	CategoryStudenten Category = iota
	// CategoryOverige is the category for other commands
	CategoryOverige Category = iota
)

func StringToCategory

func StringToCategory(in string) Category

StringToCategory gets the Category of string, case insensitive

type Command

type Command struct {
	Name        string
	Category    Category
	Description string
	Hidden      bool
	// deprecated
	Handler func(*discordgo.Session, *discordgo.MessageCreate)
}

Command is a struct of a bot command

type Interface

type Interface interface {
	Info() []Command
	Register(registry Registry, server Server)
}

Interface defines how a command should be structured

type Registry

type Registry interface {
	// if command is "" all messages will be sent
	RegisterMessageCreateHandler(command string, fn func(*discordgo.Session, *discordgo.MessageCreate))
	RegisterMessageEditHandler(command string, fn func(*discordgo.Session, *discordgo.MessageUpdate))
	RegisterMessageReactionAddHandler(fn func(*discordgo.Session, *discordgo.MessageReactionAdd))
	RegisterGuildMemberAddHandler(fn func(*discordgo.Session, *discordgo.GuildMemberAdd))
}

Registry is the interface of a command registry

type Server

type Server interface {
	GetDiscordHA() *discordha.HA
	GetAllCommandInfos() []Command
}

Server represents a discord bot server

Jump to

Keyboard shortcuts

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