|
|
|
@ -35,44 +35,6 @@ hook = decorators.generate(HOOKS, raw_nick=True, permissions=False)
@@ -35,44 +35,6 @@ hook = decorators.generate(HOOKS, raw_nick=True, permissions=False)
|
|
|
|
|
|
|
|
|
|
# Game Logic Begins: |
|
|
|
|
|
|
|
|
|
def connect_callback(cli): |
|
|
|
|
to_be_devoiced = [] |
|
|
|
|
|
|
|
|
|
@hook("whospcrpl", hookid=294) |
|
|
|
|
def on_whoreply(cli, server, nick, ident, cloak, user, status, acc): |
|
|
|
|
if user in var.USERS: return # Don't add someone who is already there |
|
|
|
|
if user == botconfig.NICK: |
|
|
|
|
cli.nickname = user |
|
|
|
|
cli.ident = ident |
|
|
|
|
cli.hostmask = cloak |
|
|
|
|
if acc == "0": |
|
|
|
|
acc = "*" |
|
|
|
|
if "+" in status: |
|
|
|
|
to_be_devoiced.append(user) |
|
|
|
|
var.USERS[user] = dict(cloak=cloak,account=acc) |
|
|
|
|
|
|
|
|
|
@hook("endofwho", hookid=294) |
|
|
|
|
def afterwho(*args): |
|
|
|
|
cmodes = [] |
|
|
|
|
for nick in to_be_devoiced: |
|
|
|
|
cmodes.append(("-v", nick)) |
|
|
|
|
# devoice all on connect |
|
|
|
|
|
|
|
|
|
@hook("quietlist", hookid=294) |
|
|
|
|
def on_quietlist(cli, server, botnick, channel, q, quieted, by, something): |
|
|
|
|
if re.match(".+\!\*@\*", quieted): # only unquiet people quieted by bot |
|
|
|
|
cmodes.append(("-q", quieted)) |
|
|
|
|
|
|
|
|
|
@hook("quietlistend", hookid=294) |
|
|
|
|
def on_quietlistend(cli, *rest): |
|
|
|
|
decorators.unhook(HOOKS, 294) |
|
|
|
|
mass_mode(cli, cmodes) |
|
|
|
|
|
|
|
|
|
cli.mode(botconfig.CHANNEL, "-m") # remove -m mode from channel |
|
|
|
|
cli.mode(botconfig.CHANNEL, "q") # unquiet all |
|
|
|
|
|
|
|
|
|
cli.who(botconfig.CHANNEL, "%nuhaf") |
|
|
|
|
|
|
|
|
|
var.LAST_PING = None # time of last ping |
|
|
|
|
var.LAST_STATS = None |
|
|
|
|
var.LAST_VOTES = None |
|
|
|
@ -112,6 +74,45 @@ def connect_callback(cli):
@@ -112,6 +74,45 @@ def connect_callback(cli):
|
|
|
|
|
var.WARN_IDLE_TIME = 0 #180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def connect_callback(cli): |
|
|
|
|
to_be_devoiced = [] |
|
|
|
|
|
|
|
|
|
@hook("whospcrpl", hookid=294) |
|
|
|
|
def on_whoreply(cli, server, nick, ident, cloak, user, status, acc): |
|
|
|
|
if user in var.USERS: return # Don't add someone who is already there |
|
|
|
|
if user == botconfig.NICK: |
|
|
|
|
cli.nickname = user |
|
|
|
|
cli.ident = ident |
|
|
|
|
cli.hostmask = cloak |
|
|
|
|
if acc == "0": |
|
|
|
|
acc = "*" |
|
|
|
|
if "+" in status: |
|
|
|
|
to_be_devoiced.append(user) |
|
|
|
|
var.USERS[user] = dict(cloak=cloak,account=acc) |
|
|
|
|
|
|
|
|
|
@hook("endofwho", hookid=294) |
|
|
|
|
def afterwho(*args): |
|
|
|
|
cmodes = [] |
|
|
|
|
for nick in to_be_devoiced: |
|
|
|
|
cmodes.append(("-v", nick)) |
|
|
|
|
# devoice all on connect |
|
|
|
|
|
|
|
|
|
@hook("quietlist", hookid=294) |
|
|
|
|
def on_quietlist(cli, server, botnick, channel, q, quieted, by, something): |
|
|
|
|
if re.match(".+\!\*@\*", quieted): # only unquiet people quieted by bot |
|
|
|
|
cmodes.append(("-q", quieted)) |
|
|
|
|
|
|
|
|
|
@hook("quietlistend", hookid=294) |
|
|
|
|
def on_quietlistend(cli, *rest): |
|
|
|
|
decorators.unhook(HOOKS, 294) |
|
|
|
|
mass_mode(cli, cmodes) |
|
|
|
|
|
|
|
|
|
cli.mode(botconfig.CHANNEL, "-m") # remove -m mode from channel |
|
|
|
|
cli.mode(botconfig.CHANNEL, "q") # unquiet all |
|
|
|
|
|
|
|
|
|
cli.who(botconfig.CHANNEL, "%nuhaf") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def mass_mode(cli, md): |
|
|
|
|