Add roles command

This commit is contained in:
Eitan Adler 2013-04-09 18:58:34 -04:00
parent 130ed3fb9d
commit 5a8b2684fe

View File

@ -13,6 +13,7 @@ import botconfig
from tools.wolfgamelogger import WolfgameLogger from tools.wolfgamelogger import WolfgameLogger
from tools import decorators from tools import decorators
from datetime import datetime, timedelta from datetime import datetime, timedelta
from operator import itemgetter
import threading import threading
import random import random
import copy import copy
@ -2623,7 +2624,21 @@ def coin(cli, nick, chan, rest):
cli.msg(chan, cmsg) cli.msg(chan, cmsg)
var.LOGGER.logMessage(cmsg) var.LOGGER.logMessage(cmsg)
@cmd("roles")
def listroles(cli, nick, chan, rest):
"""Display which roles are enabled and when"""
old = var.ROLES_GUIDE.get(None)
txt = ""
for i,v in sorted({i:var.ROLES_GUIDE[i] for i in var.ROLES_GUIDE if i is not None}.items()):
txt += "[" + str(i) + "] "
for index, amt in enumerate(v):
if amt - old[index] != 0:
txt = txt + var.ROLE_INDICES[index] + ", "
txt = txt[:-2] + " "
old = v
cli.msg(botconfig.CHANNEL, txt)
def aftergame(cli, rawnick, rest): def aftergame(cli, rawnick, rest):
"""Schedule a command to be run after the game by someone.""" """Schedule a command to be run after the game by someone."""