From bc7a2c484744587009ebfd311a0bca3305dbee92 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sat, 25 Aug 2012 00:54:03 -0400 Subject: [PATCH] Added some random sayings for the OCD bit of talker. --- plugins/talker.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/talker.go b/plugins/talker.go index 8fe1664..b412c42 100644 --- a/plugins/talker.go +++ b/plugins/talker.go @@ -3,7 +3,9 @@ package plugins import ( "bitbucket.org/phlyingpenguin/godeepintir/bot" "fmt" + "math/rand" "strings" + "time" ) type TalkerPlugin struct { @@ -36,7 +38,7 @@ func (p *TalkerPlugin) Message(message bot.Message) bool { } func (p *TalkerPlugin) LoadData() { - // no data to load yet? + rand.Seed(time.Now().Unix()) } func (p *TalkerPlugin) Help(channel string, parts []string) { @@ -46,7 +48,11 @@ 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 { - msg := fmt.Sprintf("Joins upset the hivemind's OCD, %s.", message.User.Name) + sayings := []string{ + "Real men use screen, flyngpngn.", + "Joins upset the hivemind's OCD, %s.", + } + msg := fmt.Sprintf(sayings[rand.Intn(len(sayings))], message.User.Name) p.Bot.SendMessage(message.Channel, msg) return true }