From 5b7fef27bbc16749a7b4d740942cdf1c2a35ef8a Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sun, 17 Jan 2016 12:43:07 -0500 Subject: [PATCH] Fix talker crash, factoid printing, add TODO item --- TODO.md | 1 + plugins/factoid.go | 1 - plugins/talker.go | 5 ++++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index fe61e68..af6f6ac 100644 --- a/TODO.md +++ b/TODO.md @@ -21,4 +21,5 @@ This bot was written a long time back in the spare time of a busy person. The co * Implement factoid aliasing * Implement an object system for the give/take commands * Create some kind of web reference page +* Write godoc for pretty much everything and explain why functions exist * Enter all of this into GitHub tickets diff --git a/plugins/factoid.go b/plugins/factoid.go index 877814b..b159edd 100644 --- a/plugins/factoid.go +++ b/plugins/factoid.go @@ -307,7 +307,6 @@ func (p *FactoidPlugin) findTrigger(fact string) (bool, *factoid) { f, err := getSingleFact(p.db, fact) if err != nil { - log.Printf("Looking for trigger '%s', got err: %s", fact, err) return false, nil } return true, f diff --git a/plugins/talker.go b/plugins/talker.go index b3d5d51..a45886e 100644 --- a/plugins/talker.go +++ b/plugins/talker.go @@ -103,8 +103,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 { + sayings := p.Bot.Config.WelcomeMsgs + if len(sayings) == 0 { + return false + } if kind == "JOIN" && strings.ToLower(message.User.Name) != strings.ToLower(p.Bot.Config.Nick) { - sayings := p.Bot.Config.WelcomeMsgs msg := fmt.Sprintf(sayings[rand.Intn(len(sayings))], message.User.Name) p.Bot.SendMessage(message.Channel, msg) return true