Beispiel #1
0
// 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)
	}
}
Beispiel #2
0
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)
	}
}