From fa7ed79ff68108389b4ea7f995b114ee56f06fd0 Mon Sep 17 00:00:00 2001 From: Steve McCoy Date: Thu, 30 Aug 2018 14:23:19 -0400 Subject: [PATCH] "A" "better" "fix" --- plugins/picker/picker.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/picker/picker.go b/plugins/picker/picker.go index c92d6fc..e3e375e 100644 --- a/plugins/picker/picker.go +++ b/plugins/picker/picker.go @@ -30,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. // Otherwise, the function returns false and the bot continues execution of other plugins. func (p *PickerPlugin) Message(message msg.Message) bool { + if !strings.HasPrefix(body, "pick") { + return false + } + n, items, err := p.parse(message.Body) if err != nil { p.Bot.SendMessage(message.Channel, err.Error()) @@ -64,7 +68,7 @@ var pickerListItem = regexp.MustCompile(`^([^,]+),[ \t]+`) func (p * PickerPlugin) parse(body string) (int, []string, error) { subs := pickerListPrologue.FindStringSubmatch(body) - if subs == nil && !strings.HasPrefix(body, "pick") { + if subs == nil { return 0, nil, errors.New("saddle up for a syntax error") }