rolling dice is a bit cleaner

This commit is contained in:
Elliott Pardee 2015-02-10 09:24:36 -05:00
parent f02caacbb5
commit 267ad38fb1

10
bot.go
View File

@ -3,11 +3,11 @@ package main
import (
"fmt"
"github.com/thoj/go-ircevent"
"math/rand"
"os"
"strconv"
"strings"
"time"
"math/rand"
"strconv"
)
type Bot struct {
@ -51,7 +51,7 @@ var dict = map[string]string{
var argmap = map[string]int{
".set": 4,
".print": 3,
".roll": 1,
".d": 1,
".mode": 1,
".rmmode": 1,
".dm": 1,
@ -71,7 +71,7 @@ func fillCharmap(nick string, cat string, item string, val string) {
func roll(amount int, side int) int {
var numbers = make([]int, amount)
var finaln = 0;
var finaln = 0
for i := 0; i < amount; i++ {
number := rand.Intn(side) + 1
@ -138,7 +138,7 @@ func (b *Bot) Command(nick string, msg string) {
}
break
case ".roll":
case ".d":
amount, _ := strconv.Atoi(strings.Split(args[0], "d")[0])
side, _ := strconv.Atoi(strings.Split(args[0], "d")[1])