catbase/bot/interfaces.go

46 lines
1.1 KiB
Go
Raw Normal View History

2016-03-19 19:32:51 +00:00
// © 2016 the CatBase Authors under the WTFPL license. See AUTHORS for the list of authors.
2016-03-10 18:37:07 +00:00
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)
SendAction(string, string)
MsgReceived(msg.Message)
EventReceived(msg.Message)
Filter(msg.Message, string) string
LastMessage(string) (msg.Message, error)
CheckAdmin(string) bool
}
2016-03-10 18:37:07 +00:00
type Connector interface {
RegisterEventReceived(func(message msg.Message))
RegisterMessageReceived(func(message msg.Message))
2016-03-10 18:37:07 +00:00
SendMessage(channel, message string)
SendAction(channel, message string)
Serve()
2016-04-21 15:19:38 +00:00
Who(string) []string
2016-03-10 18:37:07 +00:00
}
// 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
2016-03-10 18:37:07 +00:00
Help(channel string, parts []string)
RegisterWeb() *string
}