|
|
@ -36,15 +36,11 @@ hook = decorators.generate(HOOKS, raw_nick=True) |
|
|
|
# Game Logic Begins: |
|
|
|
# Game Logic Begins: |
|
|
|
|
|
|
|
|
|
|
|
def connect_callback(cli): |
|
|
|
def connect_callback(cli): |
|
|
|
cli.ns_identify(botconfig.PASS) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def prepare_stuff(*args): |
|
|
|
def prepare_stuff(*args): |
|
|
|
cli.join(botconfig.CHANNEL) |
|
|
|
cli.join(botconfig.CHANNEL) |
|
|
|
cli.msg("ChanServ", "op "+botconfig.CHANNEL) |
|
|
|
cli.msg("ChanServ", "op "+botconfig.CHANNEL) |
|
|
|
|
|
|
|
|
|
|
|
var.USERS = [] |
|
|
|
|
|
|
|
var.CLOAKS = [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@hook("whoreply", id=294) |
|
|
|
@hook("whoreply", id=294) |
|
|
|
def on_whoreply(cli, server, dunno, chan, dunno1, |
|
|
|
def on_whoreply(cli, server, dunno, chan, dunno1, |
|
|
|
cloak, dunno3, user, status, dunno4): |
|
|
|
cloak, dunno3, user, status, dunno4): |
|
|
@ -65,7 +61,6 @@ def connect_callback(cli): |
|
|
|
@hook("nicknameinuse") |
|
|
|
@hook("nicknameinuse") |
|
|
|
def mustghost(cli, *blah): |
|
|
|
def mustghost(cli, *blah): |
|
|
|
cli.nick(botconfig.NICK+"_") |
|
|
|
cli.nick(botconfig.NICK+"_") |
|
|
|
cli.ns_identify(botconfig.PASS) |
|
|
|
|
|
|
|
cli.ns_ghost() |
|
|
|
cli.ns_ghost() |
|
|
|
cli.nick(botconfig.NICK) |
|
|
|
cli.nick(botconfig.NICK) |
|
|
|
prepare_stuff() |
|
|
|
prepare_stuff() |
|
|
@ -73,12 +68,18 @@ def connect_callback(cli): |
|
|
|
@hook("unavailresource") |
|
|
|
@hook("unavailresource") |
|
|
|
def mustrelease(cli, *blah): |
|
|
|
def mustrelease(cli, *blah): |
|
|
|
cli.nick(botconfig.NICK+"_") |
|
|
|
cli.nick(botconfig.NICK+"_") |
|
|
|
cli.ns_identify(botconfig.PASS) |
|
|
|
|
|
|
|
cli.ns_release() |
|
|
|
cli.ns_release() |
|
|
|
cli.nick(botconfig.NICK) |
|
|
|
cli.nick(botconfig.NICK) |
|
|
|
prepare_stuff() |
|
|
|
prepare_stuff() |
|
|
|
|
|
|
|
|
|
|
|
var.LAST_PING = 0 # time of last ping |
|
|
|
var.LAST_PING = None # time of last ping |
|
|
|
|
|
|
|
var.LAST_STATS = None |
|
|
|
|
|
|
|
var.LAST_VOTES = None |
|
|
|
|
|
|
|
var.LAST_ADMINS = None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var.USERS = [] |
|
|
|
|
|
|
|
var.CLOAKS = [] |
|
|
|
|
|
|
|
|
|
|
|
var.PINGING = False |
|
|
|
var.PINGING = False |
|
|
|
var.ADMIN_PINGING = False |
|
|
|
var.ADMIN_PINGING = False |
|
|
|
var.ROLES = {"person" : []} |
|
|
|
var.ROLES = {"person" : []} |
|
|
@ -214,7 +215,7 @@ def restart_program(cli, nick, *rest): |
|
|
|
def pinger(cli, nick, chan, rest): |
|
|
|
def pinger(cli, nick, chan, rest): |
|
|
|
"""Pings the channel to get people's attention. Rate-Limited.""" |
|
|
|
"""Pings the channel to get people's attention. Rate-Limited.""" |
|
|
|
if (var.LAST_PING and |
|
|
|
if (var.LAST_PING and |
|
|
|
var.LAST_PING + timedelta(seconds=300) > datetime.now()): |
|
|
|
var.LAST_PING + timedelta(seconds=var.PING_WAIT) > datetime.now()): |
|
|
|
cli.notice(nick, ("This command is ratelimited. " + |
|
|
|
cli.notice(nick, ("This command is ratelimited. " + |
|
|
|
"Please wait a while before using it again.")) |
|
|
|
"Please wait a while before using it again.")) |
|
|
|
return |
|
|
|
return |
|
|
@ -395,6 +396,14 @@ def stats(cli, nick, chan, rest): |
|
|
|
cli.notice(nick, "No game is currently running.") |
|
|
|
cli.notice(nick, "No game is currently running.") |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (var.LAST_STATS and |
|
|
|
|
|
|
|
var.LAST_STATS + timedelta(seconds=var.STATS_RATE_LIMIT) > datetime.now()): |
|
|
|
|
|
|
|
cli.msg(chan, (nick+": This command is ratelimited. " + |
|
|
|
|
|
|
|
"Please wait a while before using it again.")) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var.LAST_STATS = datetime.now() |
|
|
|
|
|
|
|
|
|
|
|
pl = var.list_players() |
|
|
|
pl = var.list_players() |
|
|
|
pl.sort(key=lambda x: x.lower()) |
|
|
|
pl.sort(key=lambda x: x.lower()) |
|
|
|
if len(pl) > 1: |
|
|
|
if len(pl) > 1: |
|
|
@ -531,13 +540,23 @@ def chk_decision(cli): |
|
|
|
@cmd("votes") |
|
|
|
@cmd("votes") |
|
|
|
def show_votes(cli, nick, chan, rest): |
|
|
|
def show_votes(cli, nick, chan, rest): |
|
|
|
"""Displays the voting statistics.""" |
|
|
|
"""Displays the voting statistics.""" |
|
|
|
|
|
|
|
|
|
|
|
if var.PHASE in ("none", "join"): |
|
|
|
if var.PHASE in ("none", "join"): |
|
|
|
cli.notice(nick, "No game is currently running.") |
|
|
|
cli.notice(nick, "No game is currently running.") |
|
|
|
return |
|
|
|
return |
|
|
|
if var.PHASE != "day": |
|
|
|
if var.PHASE != "day": |
|
|
|
cli.notice(nick, "Voting is only during the day.") |
|
|
|
cli.notice(nick, "Voting is only during the day.") |
|
|
|
return |
|
|
|
return |
|
|
|
elif not var.VOTES.values(): |
|
|
|
|
|
|
|
|
|
|
|
if (var.LAST_VOTES and |
|
|
|
|
|
|
|
var.LAST_VOTES + timedelta(seconds=var.VOTES_RATE_LIMIT) > datetime.now()): |
|
|
|
|
|
|
|
cli.msg(chan, (nick+": This command is ratelimited. " + |
|
|
|
|
|
|
|
"Please wait a while before using it again.")) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var.LAST_VOTES = datetime.now() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not var.VOTES.values(): |
|
|
|
cli.msg(chan, nick+": No votes yet.") |
|
|
|
cli.msg(chan, nick+": No votes yet.") |
|
|
|
else: |
|
|
|
else: |
|
|
|
votelist = ["{0}: {1} ({2})".format(votee, |
|
|
|
votelist = ["{0}: {1} ({2})".format(votee, |
|
|
@ -1727,7 +1746,10 @@ def transition_night(cli): |
|
|
|
cli.msg(dttv, ("You are a \u0002detective\u0002.\n"+ |
|
|
|
cli.msg(dttv, ("You are a \u0002detective\u0002.\n"+ |
|
|
|
"It is your job to determine all the wolves and traitors. "+ |
|
|
|
"It is your job to determine all the wolves and traitors. "+ |
|
|
|
"Your job is during the day, and you can see the true "+ |
|
|
|
"Your job is during the day, and you can see the true "+ |
|
|
|
"identity of all users, even traitors.")) |
|
|
|
"identity of all users, even traitors.\n"+ |
|
|
|
|
|
|
|
"But, each time you use your ability, you risk a 2/5 "+ |
|
|
|
|
|
|
|
"chance of having your identity revealed to the wolves. So be "+ |
|
|
|
|
|
|
|
"careful. Use \"!id\" to identify any player during the day.")) |
|
|
|
for d in var.ROLES["village drunk"]: |
|
|
|
for d in var.ROLES["village drunk"]: |
|
|
|
cli.msg(d, 'You have been drinking too much! You are the \u0002village drunk\u0002.') |
|
|
|
cli.msg(d, 'You have been drinking too much! You are the \u0002village drunk\u0002.') |
|
|
|
|
|
|
|
|
|
|
@ -2096,6 +2118,14 @@ def show_admins(cli, nick, chan, rest): |
|
|
|
"""Pings the admins that are available.""" |
|
|
|
"""Pings the admins that are available.""" |
|
|
|
admins = [] |
|
|
|
admins = [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (var.LAST_ADMINS and |
|
|
|
|
|
|
|
var.LAST_ADMINS + timedelta(seconds=var.ADMINS_RATE_LIMIT) > datetime.now()): |
|
|
|
|
|
|
|
cli.msg(chan, (nick+": This command is ratelimited. " + |
|
|
|
|
|
|
|
"Please wait a while before using it again.")) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var.LAST_ADMINS = datetime.now() |
|
|
|
|
|
|
|
|
|
|
|
if var.ADMIN_PINGING: |
|
|
|
if var.ADMIN_PINGING: |
|
|
|
return |
|
|
|
return |
|
|
|
var.ADMIN_PINGING = True |
|
|
|
var.ADMIN_PINGING = True |
|
|
|