Documentation ¶
Index ¶
- Constants
- Variables
- func MakeDirectory(path string)
- type Scarecrow
- func (self *Scarecrow) Error(message string, a ...interface{})
- func (self *Scarecrow) GetReply(botUsername, username, message string, groupChat bool) string
- func (self *Scarecrow) Info(message string, a ...interface{})
- func (self *Scarecrow) InitBrain()
- func (self *Scarecrow) InitConfig()
- func (self *Scarecrow) IsAdmin(username string) bool
- func (self *Scarecrow) LoadAdminsConfig() types.AdminsConfig
- func (self *Scarecrow) LoadBotsConfig() types.BotsConfig
- func (self *Scarecrow) LoadUservars(path string)
- func (self *Scarecrow) Log(message string, a ...interface{})
- func (self *Scarecrow) LogTransaction(username, message, bot, reply string)
- func (self *Scarecrow) ManageListener(request, answer chan types.CommunicationChannel)
- func (self *Scarecrow) OnMessage(req *types.ReplyRequest, res chan types.CommunicationChannel)
- func (self *Scarecrow) OnStopped(ev *types.Stopped)
- func (self *Scarecrow) Run()
- func (self *Scarecrow) SaveAdminsConfig(cfg types.AdminsConfig)
- func (self *Scarecrow) SaveUservars(username, path string)
- func (self *Scarecrow) Shutdown()
- func (self *Scarecrow) Start()
- func (self *Scarecrow) Warn(message string, a ...interface{})
Constants ¶
const (
VERSION = "1.0.0"
)
Variables ¶
var ( RE_OP = regexp.MustCompile(`^!op ([A-Za-z0-9\.@\-_]+?)$`) RE_DEOP = regexp.MustCompile(`^!deop ([A-Za-z0-9\.@\-_]+?)$`) )
Functions ¶
func MakeDirectory ¶
func MakeDirectory(path string)
MakeDirectory makes a directory if it doesn't already exist.
Types ¶
type Scarecrow ¶
type Scarecrow struct { // Parameters. Debug bool // Internal structures. AdminsConfig types.AdminsConfig BotsConfig types.BotsConfig Brain *rivescript.RiveScript // Listeners. Listeners map[string]listeners.Listener ListenersLock sync.RWMutex }
Type Scarecrow represents the parent object of one or more bots.
func (*Scarecrow) GetReply ¶
GetReply actually gets a response for a user.
Parameters:
- botUsername: The bot's username, for logging purposes.
- username: The user's unique user ID.
- message: The user's message.
- groupChat: Whether this message originated from a public room and not a direct message.
func (*Scarecrow) InitBrain ¶
func (self *Scarecrow) InitBrain()
InitBrain loads the RiveScript brain.
func (*Scarecrow) InitConfig ¶
func (self *Scarecrow) InitConfig()
InitConfig loads the bot's configuration files.
func (*Scarecrow) LoadAdminsConfig ¶
func (self *Scarecrow) LoadAdminsConfig() types.AdminsConfig
LoadAdminsConfig loads the config/admins.json config file.
func (*Scarecrow) LoadBotsConfig ¶
func (self *Scarecrow) LoadBotsConfig() types.BotsConfig
LoadBotsConfig loads the config/bots.json config file.
func (*Scarecrow) LoadUservars ¶
LoadUservars loads a user's RiveScript variables from disk.
func (*Scarecrow) LogTransaction ¶
LogTransaction logs a full transaction between a user and the bot.
func (*Scarecrow) ManageListener ¶
func (self *Scarecrow) ManageListener(request, answer chan types.CommunicationChannel)
ManageListener manages the Request/Answer channels for each listener.
func (*Scarecrow) OnMessage ¶
func (self *Scarecrow) OnMessage(req *types.ReplyRequest, res chan types.CommunicationChannel)
func (*Scarecrow) OnStopped ¶
OnStopped handles when a listener informs us that they have been stopped.
func (*Scarecrow) SaveAdminsConfig ¶
func (self *Scarecrow) SaveAdminsConfig(cfg types.AdminsConfig)
SaveAdminsConfig saves the config/admins.json config file.
func (*Scarecrow) SaveUservars ¶
SaveUservars saves a user's RiveScript variables to disk.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
scarecrow
Main entry point for the Scarecrow chatbot application.
|
Main entry point for the Scarecrow chatbot application. |
Package listeners provides implementations for various front-ends for the Scarecrow chatbot.
|
Package listeners provides implementations for various front-ends for the Scarecrow chatbot. |
Package types contains shareable types between sub-modules.
|
Package types contains shareable types between sub-modules. |