Modify all commands call to properly call the commands
This commit is contained in:
parent
dcc23ce554
commit
49f0ba220b
@ -59,9 +59,6 @@ class cmd:
|
|||||||
if not self.raw_nick:
|
if not self.raw_nick:
|
||||||
largs[1] = nick
|
largs[1] = nick
|
||||||
|
|
||||||
if nick == "<console>":
|
|
||||||
return self.func(*largs) # special case; no questions
|
|
||||||
|
|
||||||
if not self.pm and chan == nick:
|
if not self.pm and chan == nick:
|
||||||
return # PM command, not allowed
|
return # PM command, not allowed
|
||||||
|
|
||||||
|
@ -135,12 +135,12 @@ def connect_callback(cli):
|
|||||||
|
|
||||||
def sighandler(signum, frame):
|
def sighandler(signum, frame):
|
||||||
if signum in (signal.SIGINT, signal.SIGTERM):
|
if signum in (signal.SIGINT, signal.SIGTERM):
|
||||||
forced_exit(cli, "<console>", botconfig.CHANNEL, "")
|
forced_exit.func(cli, "<console>", botconfig.CHANNEL, "")
|
||||||
elif signum == SIGUSR1:
|
elif signum == SIGUSR1:
|
||||||
restart_program(cli, "<console>", botconfig.CHANNEL, "")
|
restart_program.func(cli, "<console>", botconfig.CHANNEL, "")
|
||||||
elif signum == SIGUSR2:
|
elif signum == SIGUSR2:
|
||||||
plog("Scheduling aftergame restart")
|
plog("Scheduling aftergame restart")
|
||||||
aftergame(cli, "<console>", botconfig.CHANNEL, "frestart")
|
aftergame.func(cli, "<console>", botconfig.CHANNEL, "frestart")
|
||||||
|
|
||||||
signal.signal(signal.SIGINT, sighandler)
|
signal.signal(signal.SIGINT, sighandler)
|
||||||
signal.signal(signal.SIGTERM, sighandler)
|
signal.signal(signal.SIGTERM, sighandler)
|
||||||
@ -3593,7 +3593,7 @@ def no_lynch(cli, nick, chan, rest):
|
|||||||
def lynch(cli, nick, chan, rest):
|
def lynch(cli, nick, chan, rest):
|
||||||
"""Use this to vote for a candidate to be lynched."""
|
"""Use this to vote for a candidate to be lynched."""
|
||||||
if not rest:
|
if not rest:
|
||||||
show_votes(cli, nick, chan, rest)
|
show_votes.caller(cli, nick, chan, rest)
|
||||||
return
|
return
|
||||||
if chan != botconfig.CHANNEL:
|
if chan != botconfig.CHANNEL:
|
||||||
return
|
return
|
||||||
@ -4415,9 +4415,9 @@ def give(cli, nick, chan, rest):
|
|||||||
"""Give a totem or immunization to a player."""
|
"""Give a totem or immunization to a player."""
|
||||||
role = var.get_role(nick)
|
role = var.get_role(nick)
|
||||||
if role in var.TOTEM_ORDER:
|
if role in var.TOTEM_ORDER:
|
||||||
totem(cli, nick, chan, rest)
|
totem.caller(cli, nick, chan, rest)
|
||||||
elif role == "doctor":
|
elif role == "doctor":
|
||||||
immunize(cli, nick, chan, rest)
|
immunize.caller(cli, nick, chan, rest)
|
||||||
|
|
||||||
@cmd("totem", chan=False, pm=True, playing=True, silenced=True, phases=("night",), roles=var.TOTEM_ORDER)
|
@cmd("totem", chan=False, pm=True, playing=True, silenced=True, phases=("night",), roles=var.TOTEM_ORDER)
|
||||||
def totem(cli, nick, chan, rest):
|
def totem(cli, nick, chan, rest):
|
||||||
@ -4567,7 +4567,7 @@ def bite_cmd(cli, nick, chan, rest):
|
|||||||
vrole = None
|
vrole = None
|
||||||
# also mark the victim as the kill target
|
# also mark the victim as the kill target
|
||||||
if victim:
|
if victim:
|
||||||
kill(cli, nick, chan, rest)
|
kill.caller(cli, nick, chan, rest)
|
||||||
|
|
||||||
if var.ANGRY_WOLVES:
|
if var.ANGRY_WOLVES:
|
||||||
if not victim:
|
if not victim:
|
||||||
@ -5777,11 +5777,11 @@ def start(cli, nick, chan, forced = False, restart = ""):
|
|||||||
|
|
||||||
if var.ADMIN_TO_PING and not restart:
|
if var.ADMIN_TO_PING and not restart:
|
||||||
if "join" in COMMANDS.keys():
|
if "join" in COMMANDS.keys():
|
||||||
COMMANDS["join"] = [lambda *spam: cli.msg(chan, "This command has been disabled by an admin.")]
|
COMMANDS["join"].caller = [lambda *spam: cli.msg(chan, "This command has been disabled by an admin.")]
|
||||||
if "j" in COMMANDS.keys():
|
if "j" in COMMANDS.keys():
|
||||||
COMMANDS["j"] = [lambda *spam: cli.msg(chan, "This command has been disabled by an admin.")]
|
COMMANDS["j"].caller = [lambda *spam: cli.msg(chan, "This command has been disabled by an admin.")]
|
||||||
if "start" in COMMANDS.keys():
|
if "start" in COMMANDS.keys():
|
||||||
COMMANDS["start"] = [lambda *spam: cli.msg(chan, "This command has been disabled by an admin.")]
|
COMMANDS["start"].caller = [lambda *spam: cli.msg(chan, "This command has been disabled by an admin.")]
|
||||||
|
|
||||||
if not restart: # will already be stored if restarting
|
if not restart: # will already be stored if restarting
|
||||||
var.ALL_PLAYERS = copy.copy(var.ROLES["person"])
|
var.ALL_PLAYERS = copy.copy(var.ROLES["person"])
|
||||||
@ -6001,7 +6001,7 @@ def start(cli, nick, chan, forced = False, restart = ""):
|
|||||||
@hook("error")
|
@hook("error")
|
||||||
def on_error(cli, pfx, msg):
|
def on_error(cli, pfx, msg):
|
||||||
if msg.endswith("(Excess Flood)"):
|
if msg.endswith("(Excess Flood)"):
|
||||||
restart_program(cli, "excess flood", "")
|
restart_program.func(cli, "excess flood", "")
|
||||||
elif msg.startswith("Closing Link:"):
|
elif msg.startswith("Closing Link:"):
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
|
|
||||||
@ -6847,7 +6847,7 @@ def aftergame(cli, rawnick, chan, rest):
|
|||||||
def do_action():
|
def do_action():
|
||||||
for fn in COMMANDS[cmd]:
|
for fn in COMMANDS[cmd]:
|
||||||
fn.aftergame = True
|
fn.aftergame = True
|
||||||
fn(cli, rawnick, botconfig.CHANNEL if fn.chan else nick, " ".join(rst))
|
fn.caller(cli, rawnick, botconfig.CHANNEL if fn.chan else nick, " ".join(rst))
|
||||||
fn.aftergame = False
|
fn.aftergame = False
|
||||||
else:
|
else:
|
||||||
cli.notice(nick, "That command was not found.")
|
cli.notice(nick, "That command was not found.")
|
||||||
@ -6898,7 +6898,7 @@ def flastgame(cli, rawnick, chan, rest):
|
|||||||
var.ADMIN_TO_PING = nick
|
var.ADMIN_TO_PING = nick
|
||||||
|
|
||||||
if rest.strip():
|
if rest.strip():
|
||||||
aftergame(cli, rawnick, botconfig.CHANNEL, rest)
|
aftergame.func(cli, rawnick, botconfig.CHANNEL, rest)
|
||||||
|
|
||||||
@cmd("gamestats", "gstats", pm=True)
|
@cmd("gamestats", "gstats", pm=True)
|
||||||
def game_stats(cli, nick, chan, rest):
|
def game_stats(cli, nick, chan, rest):
|
||||||
@ -7007,7 +7007,7 @@ def player_stats(cli, nick, chan, rest):
|
|||||||
def my_stats(cli, nick, chan, rest):
|
def my_stats(cli, nick, chan, rest):
|
||||||
"""Get your own stats."""
|
"""Get your own stats."""
|
||||||
rest = rest.split()
|
rest = rest.split()
|
||||||
player_stats(cli, nick, chan, " ".join([nick] + rest))
|
player_stats.func(cli, nick, chan, " ".join([nick] + rest))
|
||||||
|
|
||||||
@cmd("game", playing=True, phases=("join",))
|
@cmd("game", playing=True, phases=("join",))
|
||||||
def game(cli, nick, chan, rest):
|
def game(cli, nick, chan, rest):
|
||||||
@ -7049,11 +7049,11 @@ def vote(cli, nick, chan, rest):
|
|||||||
"""Vote for a game mode if no game is running, or for a player to be lynched."""
|
"""Vote for a game mode if no game is running, or for a player to be lynched."""
|
||||||
if rest:
|
if rest:
|
||||||
if var.PHASE == "join" and chan != nick:
|
if var.PHASE == "join" and chan != nick:
|
||||||
return game(cli, nick, chan, rest)
|
return game.caller(cli, nick, chan, rest)
|
||||||
else:
|
else:
|
||||||
return lynch(cli, nick, chan, rest)
|
return lynch.caller(cli, nick, chan, rest)
|
||||||
else:
|
else:
|
||||||
return show_votes(cli, nick, chan, rest)
|
return show_votes.caller(cli, nick, chan, rest)
|
||||||
|
|
||||||
@cmd("fpull", admin_only=True, pm=True)
|
@cmd("fpull", admin_only=True, pm=True)
|
||||||
def fpull(cli, nick, chan, rest):
|
def fpull(cli, nick, chan, rest):
|
||||||
@ -7186,7 +7186,6 @@ if botconfig.DEBUG_MODE or botconfig.ALLOWED_NORMAL_MODE_COMMANDS:
|
|||||||
pm(cli, nick, "You are not allowed to use that command right now.")
|
pm(cli, nick, "You are not allowed to use that command right now.")
|
||||||
else:
|
else:
|
||||||
cli.notice(nick, "You are not allowed to use that command right now.")
|
cli.notice(nick, "You are not allowed to use that command right now.")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
output = []
|
output = []
|
||||||
@ -7343,9 +7342,9 @@ if botconfig.DEBUG_MODE or botconfig.ALLOWED_NORMAL_MODE_COMMANDS:
|
|||||||
continue
|
continue
|
||||||
for user in who:
|
for user in who:
|
||||||
if fn.chan:
|
if fn.chan:
|
||||||
fn(cli, user, chan, " ".join(rst))
|
fn.caller(cli, user, chan, " ".join(rst))
|
||||||
else:
|
else:
|
||||||
fn(cli, user, user, " ".join(rst))
|
fn.caller(cli, user, user, " ".join(rst))
|
||||||
cli.msg(chan, "Operation successful.")
|
cli.msg(chan, "Operation successful.")
|
||||||
else:
|
else:
|
||||||
cli.msg(chan, "That command was not found.")
|
cli.msg(chan, "That command was not found.")
|
||||||
@ -7383,9 +7382,9 @@ if botconfig.DEBUG_MODE or botconfig.ALLOWED_NORMAL_MODE_COMMANDS:
|
|||||||
continue
|
continue
|
||||||
for user in tgt[:]:
|
for user in tgt[:]:
|
||||||
if fn.chan:
|
if fn.chan:
|
||||||
fn(cli, user, chan, " ".join(rst))
|
fn.caller(cli, user, chan, " ".join(rst))
|
||||||
else:
|
else:
|
||||||
fn(cli, user, user, " ".join(rst))
|
fn.caller(cli, user, user, " ".join(rst))
|
||||||
cli.msg(chan, "Operation successful.")
|
cli.msg(chan, "Operation successful.")
|
||||||
else:
|
else:
|
||||||
cli.msg(chan, "That command was not found.")
|
cli.msg(chan, "That command was not found.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user