Fine tuning the dicks

This commit is contained in:
Chris Sexton 2013-01-22 16:16:27 -05:00
parent 66e2c8265d
commit bcbd41a9b6
1 changed files with 8 additions and 4 deletions

View File

@ -46,12 +46,16 @@ func (p *DicePlugin) Message(message bot.Message) bool {
if len(dice) == 2 { if len(dice) == 2 {
// We actually have a die roll. // We actually have a die roll.
nDice, err := strconv.Atoi(dice[0]) nDice, err := strconv.Atoi(dice[0])
if err != nil || nDice < 1 || nDice > 20 { if err != nil {
p.Bot.SendMessage(channel, "You're a dick.") return false
return true
} }
sides, err := strconv.Atoi(dice[1]) 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.") p.Bot.SendMessage(channel, "You're a dick.")
return true return true
} }