Allow !fquit to leave someone from deadchat

This commit is contained in:
Vgr E. Barry 2015-10-28 22:15:18 -04:00
parent bc8b336640
commit c525380be6

View File

@ -1126,11 +1126,15 @@ def join_deadchat(cli, *all_nicks):
return True return True
def leave_deadchat(cli, nick): def leave_deadchat(cli, nick, force=""):
if var.PHASE not in ("day", "night") or nick not in var.DEADCHAT_PLAYERS: if var.PHASE not in ("day", "night") or nick not in var.DEADCHAT_PLAYERS:
return False return False
var.DEADCHAT_PLAYERS.remove(nick) var.DEADCHAT_PLAYERS.remove(nick)
if force:
pm(cli, nick, "You have been forcibly removed from the chat by \u0002{0}\u0002.".format(force))
mass_privmsg(cli, var.DEADCHAT_PLAYERS, "\u0002{0}\u0002 has been removed from the chat by \u0002{1}\u0002.".format(nick, force))
else:
pm(cli, nick, "You have left the chat.") pm(cli, nick, "You have left the chat.")
mass_privmsg(cli, var.DEADCHAT_PLAYERS, "\u0002{0}\u0002 has left the chat.".format(nick)) mass_privmsg(cli, var.DEADCHAT_PLAYERS, "\u0002{0}\u0002 has left the chat.".format(nick))
@ -1410,7 +1414,7 @@ def fjoin(cli, nick, chan, rest):
if fake: if fake:
cli.msg(chan, "\u0002{0}\u0002 used fjoin and raised the number of players to \u0002{1}\u0002.".format(nick, len(var.list_players()))) cli.msg(chan, "\u0002{0}\u0002 used fjoin and raised the number of players to \u0002{1}\u0002.".format(nick, len(var.list_players())))
@cmd("fleave", "fquit", admin_only=True, phases=("join", "day", "night")) @cmd("fleave", "fquit", admin_only=True, pm=True, phases=("join", "day", "night"))
def fleave(cli, nick, chan, rest): def fleave(cli, nick, chan, rest):
"""Forces someone to leave the game.""" """Forces someone to leave the game."""
if chan != botconfig.CHANNEL: if chan != botconfig.CHANNEL:
@ -1422,11 +1426,10 @@ def fleave(cli, nick, chan, rest):
continue continue
pl = var.list_players() pl = var.list_players()
pll = [x.lower() for x in pl] pll = [x.lower() for x in pl]
dcl = list(var.DEADCHAT_PLAYERS)
dcll = [x.lower() for x in dcl]
if a.lower() in pll: if a.lower() in pll:
a = pl[pll.index(a.lower())] a = pl[pll.index(a.lower())]
else:
cli.msg(chan, nick+": That person is not playing.")
return
message = "\u0002{0}\u0002 is forcing \u0002{1}\u0002 to leave.".format(nick, a) message = "\u0002{0}\u0002 is forcing \u0002{1}\u0002 to leave.".format(nick, a)
if var.get_role(a) != "person" and var.ROLE_REVEAL: if var.get_role(a) != "person" and var.ROLE_REVEAL:
@ -1441,6 +1444,17 @@ def fleave(cli, nick, chan, rest):
del_player(cli, a, death_triggers=False) del_player(cli, a, death_triggers=False)
elif a.lower() in dcll:
a = dcl[dcll.index(a.lower())]
leave_deadchat(cli, a, force=nick)
else:
cli.msg(chan, nick+": That person is not playing.")
return
@cmd("fstart", admin_only=True, phases=("join",)) @cmd("fstart", admin_only=True, phases=("join",))
def fstart(cli, nick, chan, rest): def fstart(cli, nick, chan, rest):