Modify is_user_stasised to return only an integer, not a tuple
This commit is contained in:
parent
0eee4b1c88
commit
ff53ad4bcf
@ -893,7 +893,7 @@ def join_timer_handler(cli):
|
|||||||
|
|
||||||
@hook("whoreply", hookid=387)
|
@hook("whoreply", hookid=387)
|
||||||
def ping_altpingers_noacc(cli, svr, botnick, chan, user, host, server, nick, status, rest):
|
def ping_altpingers_noacc(cli, svr, botnick, chan, user, host, server, nick, status, rest):
|
||||||
if ("G" in status or is_user_stasised(nick)[0] or not var.PINGING_IFS or
|
if ("G" in status or is_user_stasised(nick) or not var.PINGING_IFS or
|
||||||
nick == botnick or nick in pl):
|
nick == botnick or nick in pl):
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -902,7 +902,7 @@ def join_timer_handler(cli):
|
|||||||
|
|
||||||
@hook("whospcrpl", hookid=387)
|
@hook("whospcrpl", hookid=387)
|
||||||
def ping_altpingers(cli, server, nick, ident, cloak, _, user, status, acc):
|
def ping_altpingers(cli, server, nick, ident, cloak, _, user, status, acc):
|
||||||
if ("G" in status or is_user_stasised(user)[0] or not var.PINGING_IFS or
|
if ("G" in status or is_user_stasised(user) or not var.PINGING_IFS or
|
||||||
user == botconfig.NICK or user in pl):
|
user == botconfig.NICK or user in pl):
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -983,10 +983,10 @@ def join_player(cli, player, chan, who = None, forced = False):
|
|||||||
if not acc or acc == "*" or var.DISABLE_ACCOUNTS:
|
if not acc or acc == "*" or var.DISABLE_ACCOUNTS:
|
||||||
acc = None
|
acc = None
|
||||||
|
|
||||||
(is_stasised, stasis_amt) = is_user_stasised(player)
|
stasis = is_user_stasised(player)
|
||||||
|
|
||||||
if is_stasised:
|
if stasis:
|
||||||
if forced and stasis_amt == 1:
|
if forced and stasis == 1:
|
||||||
if cloak in var.STASISED:
|
if cloak in var.STASISED:
|
||||||
var.set_stasis(cloak, 0)
|
var.set_stasis(cloak, 0)
|
||||||
del var.STASISED[cloak]
|
del var.STASISED[cloak]
|
||||||
@ -995,8 +995,8 @@ def join_player(cli, player, chan, who = None, forced = False):
|
|||||||
del var.STASISED_ACCS[acc]
|
del var.STASISED_ACCS[acc]
|
||||||
else:
|
else:
|
||||||
cli.notice(who, "Sorry, but {0} in stasis for {1} game{2}.".format(
|
cli.notice(who, "Sorry, but {0} in stasis for {1} game{2}.".format(
|
||||||
"you are" if player == who else player + " is", is_user_stasised(player)[1],
|
"you are" if player == who else player + " is", stasis,
|
||||||
"s" if is_user_stasised(player)[1] != 1 else ""))
|
"s" if stasis != 1 else ""))
|
||||||
return
|
return
|
||||||
|
|
||||||
cmodes = [("+v", player)]
|
cmodes = [("+v", player)]
|
||||||
@ -7103,25 +7103,20 @@ def fstasis(cli, nick, chan, rest):
|
|||||||
cli.msg(chan, msg)
|
cli.msg(chan, msg)
|
||||||
|
|
||||||
def is_user_stasised(nick):
|
def is_user_stasised(nick):
|
||||||
"""Checks if a user is in stasis. Returns a tuple of two items.
|
"""Checks if a user is in stasis. Returns a number of games in stasis."""
|
||||||
|
|
||||||
First parameter is True or False, and tells if the user is in stasis.
|
|
||||||
If the first parameter is False, the second will always be None.
|
|
||||||
If the first parameter is True, the second is an integer of the amount
|
|
||||||
of games the user is in stasis."""
|
|
||||||
|
|
||||||
if nick in var.USERS:
|
if nick in var.USERS:
|
||||||
cloak = var.USERS[nick]["cloak"]
|
cloak = var.USERS[nick]["cloak"]
|
||||||
acc = var.USERS[nick]["account"]
|
acc = var.USERS[nick]["account"]
|
||||||
else:
|
else:
|
||||||
return False, None
|
return 0
|
||||||
if not var.DISABLE_ACCOUNTS and acc and acc != "*":
|
if not var.DISABLE_ACCOUNTS and acc and acc != "*":
|
||||||
if acc in var.STASISED_ACCS:
|
if acc in var.STASISED_ACCS:
|
||||||
return True, var.STASISED_ACCS[acc]
|
return var.STASISED_ACCS[acc]
|
||||||
for clk in var.STASISED:
|
for clk in var.STASISED:
|
||||||
if fnmatch.fnmatch(cloak, clk):
|
if fnmatch.fnmatch(cloak, clk):
|
||||||
return True, var.STASISED[clk]
|
return var.STASISED[clk]
|
||||||
return False, None
|
return 0
|
||||||
|
|
||||||
def allow_deny(cli, nick, chan, rest, mode):
|
def allow_deny(cli, nick, chan, rest, mode):
|
||||||
data = rest.split()
|
data = rest.split()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user