示例#1
0
文件: dice.go 项目: natrim/grainbot
// handle the irc message
func throwDice(r *irc.Message, dice, faces int) {
	r.Action("kicks the dice to you...")

	result := diceRoll(dice, faces)
	if result != "" {
		r.Mentionf("you rolled %d-sided dice %d times and the result is: %s", faces, dice, result)
	}
}
示例#2
0
文件: coin.go 项目: natrim/grainbot
func throwCoin(r *irc.Message) {
	r.Action("kicks a coin...")

	var result string
	if rand.Float32() < 0.5 {
		result = "Got Head!"
	} else {
		result = "Got Tail!"
	}

	if result != "" {
		r.Respond(result)
	}
}