Check errors

This commit is contained in:
Chris Sexton 2013-01-22 14:54:27 -05:00
parent ae42e62872
commit 5d90f7a920
1 changed files with 8 additions and 2 deletions

View File

@ -45,8 +45,14 @@ 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, _ := strconv.Atoi(dice[0]) nDice, err := strconv.Atoi(dice[0])
sides, _ := strconv.Atoi(dice[1]) if err != nil {
return false
}
sides, err := strconv.Atoi(dice[1])
if err != nil {
return false
}
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++ {