Moved welcome messages to config file for easier updating

This commit is contained in:
Chris Sexton 2013-01-12 11:32:42 -05:00
parent 172567004a
commit 0552c5048d
3 changed files with 8 additions and 5 deletions

View File

@ -18,6 +18,12 @@
"comment": "Follows is the old bot",
"WelcomeMsgs": [
"Real men use screen, %s.",
"Joins upset the hivemind's OCD, %s.",
"Joins upset the hivemind's CDO, %s.",
],
"bot": {
"dbname": "deepintir",
"inchan": "out",

View File

@ -21,6 +21,7 @@ type Config struct {
Admins []string
UntappdToken string
UntappdFreq int
WelcomeMsgs []string
}
// Readconfig loads the config data out of a JSON file located in cfile

View File

@ -55,11 +55,7 @@ func (p *TalkerPlugin) Help(channel string, parts []string) {
// Empty event handler because this plugin does not do anything on event recv
func (p *TalkerPlugin) Event(kind string, message bot.Message) bool {
if kind == "JOIN" && message.User.Name != p.Bot.Config.Nick {
sayings := []string{
"Real men use screen, %s.",
"Joins upset the hivemind's OCD, %s.",
"Joins upset the hivemind's CDO, %s.",
}
sayings := p.Bot.Config.WelcomeMsgs
msg := fmt.Sprintf(sayings[rand.Intn(len(sayings))], message.User.Name)
p.Bot.SendMessage(message.Channel, msg)
return true