mirror of https://github.com/velour/catbase.git
Fix talker crash, factoid printing, add TODO item
This commit is contained in:
parent
56c6d84813
commit
5b7fef27bb
1
TODO.md
1
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 factoid aliasing
|
||||||
* Implement an object system for the give/take commands
|
* Implement an object system for the give/take commands
|
||||||
* Create some kind of web reference page
|
* 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
|
* Enter all of this into GitHub tickets
|
||||||
|
|
|
@ -307,7 +307,6 @@ func (p *FactoidPlugin) findTrigger(fact string) (bool, *factoid) {
|
||||||
|
|
||||||
f, err := getSingleFact(p.db, fact)
|
f, err := getSingleFact(p.db, fact)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Looking for trigger '%s', got err: %s", fact, err)
|
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
return true, f
|
return true, f
|
||||||
|
|
|
@ -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
|
// Empty event handler because this plugin does not do anything on event recv
|
||||||
func (p *TalkerPlugin) Event(kind string, message bot.Message) bool {
|
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
|
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)
|
msg := fmt.Sprintf(sayings[rand.Intn(len(sayings))], message.User.Name)
|
||||||
p.Bot.SendMessage(message.Channel, msg)
|
p.Bot.SendMessage(message.Channel, msg)
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in New Issue