Documentation
¶
Overview ¶
Package botmaid is a package includes more useful public functions for bots.
Index ¶
- func AddCommand(cs *[]Command, f func(*api.Event, *Bot) bool, p int)
- func AddTimer(ts *[]Timer, f func(), t time.Time, fre string)
- func RandomWordWithWeight(ws []Word) string
- func RegHelpCommand(cs *[]Command, hs *Help)
- func SplitCommand(c string) []string
- type Bot
- type BotMaid
- type Command
- type CommandSlice
- type Help
- type Timer
- type Word
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCommand ¶ added in v1.0.1
AddCommand adds a command into the []Command.
func RandomWordWithWeight ¶ added in v1.0.1
RandomWordWithWeight returns a random string from the Word slice according to the weight.
func RegHelpCommand ¶ added in v1.0.1
RegHelpCommand adds help as a high-priority command if a Help is defined and going to be used.
func SplitCommand ¶ added in v1.0.1
SplitCommand splits a string into a slice of string.
Types ¶
type Bot ¶
Bot includes some information of a bot.
func (*Bot) CheckBeAt ¶ added in v1.0.1
CheckBeAt checks if someone send a message without commands and at the api.
type BotMaid ¶
type BotMaid struct {
Bots []Bot
}
BotMaid includes a slice of Bot and some methods to use them.
type Command ¶
Command is a func with priority value so that we can sort some Commands to make them in a specific order.
type CommandSlice ¶
type CommandSlice []Command
CommandSlice is a slice of Command that could be sort.
func (CommandSlice) Less ¶
func (cs CommandSlice) Less(i, j int) bool
Less returns true if CommandSlice[i] is less then CommandSlice[j].
func (CommandSlice) Swap ¶
func (cs CommandSlice) Swap(i, j int)
Swap swaps CommandSlice[i] and CommandSlice[j].