mirror of https://github.com/velour/catbase.git
55 lines
1.5 KiB
Go
55 lines
1.5 KiB
Go
// © 2016 the CatBase Authors under the WTFPL license. See AUTHORS for the list of authors.
|
|
|
|
package bot
|
|
|
|
import (
|
|
"github.com/jmoiron/sqlx"
|
|
"github.com/velour/catbase/bot/msg"
|
|
"github.com/velour/catbase/bot/user"
|
|
"github.com/velour/catbase/config"
|
|
)
|
|
|
|
type Bot interface {
|
|
Config() *config.Config
|
|
DBVersion() int64
|
|
DB() *sqlx.DB
|
|
Who(string) []user.User
|
|
AddHandler(string, Handler)
|
|
SendMessage(string, string) string
|
|
SendAction(string, string) string
|
|
ReplyToMessage(channel, message, identifier string) (string, bool)
|
|
React(string, string, msg.Message) bool
|
|
Edit(string, string, string) bool
|
|
MsgReceived(msg.Message)
|
|
EventReceived(msg.Message)
|
|
Filter(msg.Message, string) string
|
|
LastMessage(string) (msg.Message, error)
|
|
CheckAdmin(string) bool
|
|
GetEmojiList() map[string]string
|
|
RegisterFilter(string, func(string) string)
|
|
}
|
|
|
|
type Connector interface {
|
|
RegisterEventReceived(func(message msg.Message))
|
|
RegisterMessageReceived(func(message msg.Message))
|
|
|
|
SendMessage(channel, message string) string
|
|
SendAction(channel, message string) string
|
|
ReplyToMessage(channel, message, identifier string) (string, bool)
|
|
React(string, string, msg.Message) bool
|
|
Edit(string, string, string) bool
|
|
GetEmojiList() map[string]string
|
|
Serve() error
|
|
|
|
Who(string) []string
|
|
}
|
|
|
|
// Interface used for compatibility with the Plugin interface
|
|
type Handler interface {
|
|
Message(message msg.Message) bool
|
|
Event(kind string, message msg.Message) bool
|
|
BotMessage(message msg.Message) bool
|
|
Help(channel string, parts []string)
|
|
RegisterWeb() *string
|
|
}
|