示例#1
0
// informs channel of the outcome of a match
func announceWinner(data *spicerack.FightCard) {
	p1 := formatFighterName(nil, data.RedName, P1_NAME_FORMAT)
	p2 := formatFighterName(nil, data.BlueName, P2_NAME_FORMAT)
	var w, l, msg string

	if data.Winner() == data.RedName {
		w = p1
		l = p2
	} else if data.Winner() == data.BlueName {
		w = p2
		l = p1
	} else {
		msg = "...I have no idea who won."
	}

	if data.Upset(UPSET_FACTOR) {
		msg = fmt.Sprintf(UPSET_WINNER_FORMAT, data.Odds(), w, l)
	} else {
		msg = fmt.Sprintf(WINNER_FORMAT, w, l)
	}

	client.Privmsg(settings.Channel, msg)
}
示例#2
0
// sends odds to channel when available
func announceOdds(data *spicerack.FightCard) {
	p1 := formatFighterName(nil, data.RedName, P1_NAME_FORMAT)
	p2 := formatFighterName(nil, data.BlueName, P2_NAME_FORMAT)
	msg := fmt.Sprintf("%s %s %s", p1, data.Odds(), p2)
	client.Privmsg(settings.Channel, msg)
}