Ejemplo n.º 1
0
def stat_print(lrrbot,
               conn,
               event,
               respond_to,
               stat,
               game=None,
               with_emote=False):
    stat = stat.lower()
    if game is None:
        game = lrrbot.get_current_game()
        if game is None:
            conn.privmsg(respond_to, "Not currently playing any game")
            return
    count = game.get("stats", {}).get(stat, 0)
    show = lrrbot.show_override or lrrbot.show
    stat_details = storage.data["stats"][stat]
    display = stat_details.get("singular",
                               stat) if count == 1 else stat_details.get(
                                   "plural", stat + "s")
    if with_emote and stat_details.get("emote"):
        emote = stat_details["emote"] + " "
    else:
        emote = ""
    conn.privmsg(
        respond_to, "%s%d %s for %s on %s" %
        (emote, count, display, game_name(game), show_name(show)))
Ejemplo n.º 2
0
def vote_respond(lrrbot, conn, respond_to, game):
    if game and game.get("votes"):
        good = sum(game["votes"].values())
        count = len(game["votes"])
        show = lrrbot.show_override or lrrbot.show

        conn.privmsg(
            respond_to, "Rating for %s on %s is now %.0f%% (%d/%d)" %
            (game_name(game), show_name(show), 100 * good / count, good,
             count))
    lrrbot.vote_update = None
Ejemplo n.º 3
0
def vote_respond(lrrbot, conn, respond_to, game):
	if game and game.get("votes"):
		good = sum(game["votes"].values())
		count = len(game["votes"])
		show = lrrbot.show_override or lrrbot.show
		
		conn.privmsg(respond_to, "Rating for %s on %s is now %.0f%% (%d/%d)" % (game_name(game), show_name(show), 100*good/count, good, count))
	lrrbot.vote_update = None
Ejemplo n.º 4
0
def stat_print(lrrbot, conn, event, respond_to, stat, game=None, with_emote=False):
	stat = stat.lower()
	if game is None:
		game = lrrbot.get_current_game()
		if game is None:
			conn.privmsg(respond_to, "Not currently playing any game")
			return
	count = game.get("stats", {}).get(stat, 0)
	show = lrrbot.show_override or lrrbot.show
	stat_details = storage.data["stats"][stat]
	display = stat_details.get("singular", stat) if count == 1 else stat_details.get("plural", stat + "s")
	if with_emote and stat_details.get("emote"):
		emote = stat_details["emote"] + " "
	else:
		emote = ""
	conn.privmsg(respond_to, "%s%d %s for %s on %s" % (emote, count, display, game_name(game), show_name(show)))