Fix talker crash, factoid printing, add TODO item

This commit is contained in:
Chris Sexton 2016-01-17 12:43:07 -05:00
parent 56c6d84813
commit 5b7fef27bb
3 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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 {
if kind == "JOIN" && strings.ToLower(message.User.Name) != strings.ToLower(p.Bot.Config.Nick) {
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) {
msg := fmt.Sprintf(sayings[rand.Intn(len(sayings))], message.User.Name)
p.Bot.SendMessage(message.Channel, msg)
return true