Merge pull request #108 from mccoyst/pick-a-choose

Pick a choose
This commit is contained in:
Chris Sexton 2018-08-30 14:34:13 -04:00 committed by GitHub
commit 0956fd6044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -3,7 +3,9 @@
package picker package picker
import ( import (
"errors"
"regexp" "regexp"
"strconv"
"strings" "strings"
"fmt" "fmt"
@ -28,6 +30,10 @@ func New(bot bot.Bot) *PickerPlugin {
// This function returns true if the plugin responds in a meaningful way to the users message. // This function returns true if the plugin responds in a meaningful way to the users message.
// Otherwise, the function returns false and the bot continues execution of other plugins. // Otherwise, the function returns false and the bot continues execution of other plugins.
func (p *PickerPlugin) Message(message msg.Message) bool { func (p *PickerPlugin) Message(message msg.Message) bool {
if !strings.HasPrefix(body, "pick") {
return false
}
n, items, err := p.parse(message.Body) n, items, err := p.parse(message.Body)
if err != nil { if err != nil {
p.Bot.SendMessage(message.Channel, err.Error()) p.Bot.SendMessage(message.Channel, err.Error())