mirror of https://github.com/velour/catbase.git
picker: less strict (no command)
This commit is contained in:
parent
5e52c3bb16
commit
22bca5bf4d
|
@ -34,10 +34,6 @@ func rollDie(sides int) int {
|
||||||
// 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 !message.Command {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
body := message.Body
|
body := message.Body
|
||||||
pfx, sfx := "pick {", "}"
|
pfx, sfx := "pick {", "}"
|
||||||
|
|
||||||
|
@ -46,7 +42,7 @@ func (p *PickerPlugin) Message(message msg.Message) bool {
|
||||||
items := strings.Split(body, ",")
|
items := strings.Split(body, ",")
|
||||||
item := items[rand.Intn(len(items))]
|
item := items[rand.Intn(len(items))]
|
||||||
|
|
||||||
out := fmt.Sprintf("I've chosen \"%s\" for you.", item)
|
out := fmt.Sprintf("I've chosen \"%s\" for you.", strings.TrimSpace(item))
|
||||||
|
|
||||||
p.Bot.SendMessage(message.Channel, out)
|
p.Bot.SendMessage(message.Channel, out)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue