From 0552c5048d83dcac657c5f93f909c0e75858a880 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sat, 12 Jan 2013 11:32:42 -0500 Subject: [PATCH] Moved welcome messages to config file for easier updating --- config.json | 6 ++++++ config/config.go | 1 + plugins/talker.go | 6 +----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/config.json b/config.json index cae4dc3..6a6290e 100644 --- a/config.json +++ b/config.json @@ -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", diff --git a/config/config.go b/config/config.go index bfce436..7fe3884 100644 --- a/config/config.go +++ b/config/config.go @@ -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 diff --git a/plugins/talker.go b/plugins/talker.go index 4fc96c7..d3ed9cb 100644 --- a/plugins/talker.go +++ b/plugins/talker.go @@ -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