fixing more things because of assholes

This commit is contained in:
Chris Sexton 2013-01-22 15:06:14 -05:00
parent 4af719fe5b
commit a887d0bba9
1 changed files with 7 additions and 8 deletions

View File

@ -43,20 +43,19 @@ func (p *DicePlugin) Message(message bot.Message) bool {
dice = strings.Split(parts[1], "d") dice = strings.Split(parts[1], "d")
} }
if dice < 1 || sides < 2 {
p.Bot.SendMessage(channel, "You're a dick.")
}
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 { if err != nil || nDice < 1 {
return false p.Bot.SendMessage(channel, "You're a dick.")
return true
} }
sides, err := strconv.Atoi(dice[1]) sides, err := strconv.Atoi(dice[1])
if err != nil { if err != nil || sides < 2 {
return false p.Bot.SendMessage(channel, "You're a dick.")
return true
} }
rolls := fmt.Sprintf("%s, you rolled: ", message.User.Name) rolls := fmt.Sprintf("%s, you rolled: ", message.User.Name)
for i := 0; i < nDice; i++ { for i := 0; i < nDice; i++ {