Fixes #32: Make quote/remember case insensitive keywords

This commit is contained in:
Chris Sexton 2013-08-31 22:24:10 -04:00
parent b97886fdde
commit 776d363595
1 changed files with 4 additions and 2 deletions

View File

@ -39,7 +39,7 @@ func NewRememberPlugin(b *bot.Bot) *RememberPlugin {
// execution of other plugins. // execution of other plugins.
func (p *RememberPlugin) Message(message bot.Message) bool { func (p *RememberPlugin) Message(message bot.Message) bool {
if message.Body == "quote" && message.Command { if strings.ToLower(message.Body) == "quote" && message.Command {
q := p.randQuote() q := p.randQuote()
p.Bot.SendMessage(message.Channel, q) p.Bot.SendMessage(message.Channel, q)
@ -49,7 +49,9 @@ func (p *RememberPlugin) Message(message bot.Message) bool {
user := message.User user := message.User
parts := strings.Split(message.Body, " ") parts := strings.Split(message.Body, " ")
if message.Command && len(parts) >= 3 && parts[0] == "remember" { if message.Command && len(parts) >= 3 &&
strings.ToLower(parts[0]) == "remember" {
// we have a remember! // we have a remember!
// look through the logs and find parts[1] as a user, if not, // look through the logs and find parts[1] as a user, if not,
// fuck this hoser // fuck this hoser