From bcbd41a9b6fcad50c11fc101f38b9b7c257ccf41 Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Tue, 22 Jan 2013 16:16:27 -0500 Subject: [PATCH] Fine tuning the dicks --- plugins/dice.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/dice.go b/plugins/dice.go index 675c650..fc8a9e9 100644 --- a/plugins/dice.go +++ b/plugins/dice.go @@ -46,12 +46,16 @@ func (p *DicePlugin) Message(message bot.Message) bool { if len(dice) == 2 { // We actually have a die roll. nDice, err := strconv.Atoi(dice[0]) - if err != nil || nDice < 1 || nDice > 20 { - p.Bot.SendMessage(channel, "You're a dick.") - return true + if err != nil { + return false } + sides, err := strconv.Atoi(dice[1]) - if err != nil || sides < 2 { + if err != nil { + return false + } + + if sides < 2 || nDice < 1 || nDice > 20 { p.Bot.SendMessage(channel, "You're a dick.") return true }