From a887d0bba92171258f9e5a2384d2b3afcfcbd14e Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Tue, 22 Jan 2013 15:06:14 -0500 Subject: [PATCH] fixing more things because of assholes --- plugins/dice.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/plugins/dice.go b/plugins/dice.go index ab4dc13..b8d1108 100644 --- a/plugins/dice.go +++ b/plugins/dice.go @@ -43,20 +43,19 @@ func (p *DicePlugin) Message(message bot.Message) bool { dice = strings.Split(parts[1], "d") } - if dice < 1 || sides < 2 { - p.Bot.SendMessage(channel, "You're a dick.") - } - if len(dice) == 2 { // We actually have a die roll. nDice, err := strconv.Atoi(dice[0]) - if err != nil { - return false + if err != nil || nDice < 1 { + p.Bot.SendMessage(channel, "You're a dick.") + return true } sides, err := strconv.Atoi(dice[1]) - if err != nil { - return false + if err != nil || sides < 2 { + p.Bot.SendMessage(channel, "You're a dick.") + return true } + rolls := fmt.Sprintf("%s, you rolled: ", message.User.Name) for i := 0; i < nDice; i++ {