Kill USE_NICKSERV_GHOST, default more things in settings.py
Whether or not GHOST is used now depends on if NICKSERV_RELEASE_COMMAND or NICKSERV_REGAIN_COMMAND are empty. Also, we do not try to go into an infinite loop should the command we use fail to work, and instead just run with a "wrong" nick. Not tested at all, so blame ilbelkyr when things inevitably don't work with it (and while you're blaming him, get him to fix the ASM website).
This commit is contained in:
parent
73fb0c65c9
commit
24ae5c1e39
@ -75,6 +75,4 @@ TIMESTAMP_FORMAT = "[%Y-%m-%d %H:%M:%S{tzoffset}]"
|
|||||||
#CHANSERV = "x@channels.undernet.org"
|
#CHANSERV = "x@channels.undernet.org"
|
||||||
#CHANSERV_OP_COMMAND = "OP {channel}"
|
#CHANSERV_OP_COMMAND = "OP {channel}"
|
||||||
|
|
||||||
USE_NICKSERV_GHOST = False # If set to True, the bot will GHOST users using the bot's nick. Otherwise, it will use RELEASE
|
|
||||||
|
|
||||||
# vim: set ft=python:
|
# vim: set ft=python:
|
||||||
|
@ -90,17 +90,26 @@ def connect_callback(cli):
|
|||||||
def mustregain(cli, server, bot_nick, nick, msg):
|
def mustregain(cli, server, bot_nick, nick, msg):
|
||||||
if not botconfig.PASS or bot_nick == nick:
|
if not botconfig.PASS or bot_nick == nick:
|
||||||
return
|
return
|
||||||
|
if var.NICKSERV_REGAIN_COMMAND:
|
||||||
cli.ns_regain(nick=botconfig.NICK, password=botconfig.PASS, nickserv=var.NICKSERV, command=var.NICKSERV_REGAIN_COMMAND)
|
cli.ns_regain(nick=botconfig.NICK, password=botconfig.PASS, nickserv=var.NICKSERV, command=var.NICKSERV_REGAIN_COMMAND)
|
||||||
|
else:
|
||||||
|
cli.ns_ghost(nick=botconfig.NICK, password=botconfig.PASS, nickserv=var.NICKSERV, command=var.NICKSERV_GHOST_COMMAND)
|
||||||
|
# infinite loops are bad
|
||||||
|
hook.unhook(241)
|
||||||
users.Bot.change_nick(botconfig.NICK)
|
users.Bot.change_nick(botconfig.NICK)
|
||||||
|
hook("nicknameinuse", hookid=241)(mustregain)
|
||||||
|
|
||||||
def mustrelease(cli, server, bot_nick, nick, msg):
|
def mustrelease(cli, server, bot_nick, nick, msg):
|
||||||
if not botconfig.PASS or bot_nick == nick:
|
if not botconfig.PASS or bot_nick == nick:
|
||||||
return # prevents the bot from trying to release without a password
|
return # prevents the bot from trying to release without a password
|
||||||
func = cli.ns_release
|
if var.NICKSERV_RELEASE_COMMAND:
|
||||||
if botconfig.USE_NICKSERV_GHOST:
|
cli.ns_release(nick=botconfig.NICK, password=botconfig.PASS, nickserv=var.NICKSERV, command=var.NICKSERV_GHOST_COMMAND)
|
||||||
func = cli.ns_ghost
|
else:
|
||||||
func(nick=botconfig.NICK, password=botconfig.PASS, nickserv=var.NICKSERV, command=var.NICKSERV_RELEASE_COMMAND)
|
cli.ns_ghost(nick=botconfig.NICK, password=botconfig.PASS, nickserv=var.NICKSERV, command=var.NICKSERV_GHOST_COMMAND)
|
||||||
|
# if releasing doesn't work, don't go into infinite loop, just run with our _ showing
|
||||||
|
hook.unhook(240)
|
||||||
users.Bot.change_nick(botconfig.NICK)
|
users.Bot.change_nick(botconfig.NICK)
|
||||||
|
hook("unavailresource", hookid=240)(mustrelease)
|
||||||
|
|
||||||
@hook("unavailresource", hookid=239)
|
@hook("unavailresource", hookid=239)
|
||||||
@hook("nicknameinuse", hookid=239)
|
@hook("nicknameinuse", hookid=239)
|
||||||
@ -110,8 +119,8 @@ def connect_callback(cli):
|
|||||||
cli.user(botconfig.NICK, "") # TODO: can we remove this?
|
cli.user(botconfig.NICK, "") # TODO: can we remove this?
|
||||||
|
|
||||||
hook.unhook(239)
|
hook.unhook(239)
|
||||||
hook("unavailresource")(mustrelease)
|
hook("unavailresource", hookid=240)(mustrelease)
|
||||||
hook("nicknameinuse")(mustregain)
|
hook("nicknameinuse", hookid=241)(mustregain)
|
||||||
|
|
||||||
request_caps = {"account-notify", "extended-join", "multi-prefix"}
|
request_caps = {"account-notify", "extended-join", "multi-prefix"}
|
||||||
|
|
||||||
|
@ -200,6 +200,10 @@ GUEST_NICK_PATTERN = r"^Guest\d+$|^\d|away.+|.+away"
|
|||||||
|
|
||||||
LOG_CHANNEL = "" # Log !fwarns to this channel, if set
|
LOG_CHANNEL = "" # Log !fwarns to this channel, if set
|
||||||
LOG_PREFIX = "" # Message prefix for LOG_CHANNEL
|
LOG_PREFIX = "" # Message prefix for LOG_CHANNEL
|
||||||
|
DEV_CHANNEL = ""
|
||||||
|
DEV_PREFIX = ""
|
||||||
|
PASTEBIN_ERRORS = False
|
||||||
|
|
||||||
|
|
||||||
# TODO: move this to a game mode called "fixed" once we implement a way to randomize roles (and have that game mode be called "random")
|
# TODO: move this to a game mode called "fixed" once we implement a way to randomize roles (and have that game mode be called "random")
|
||||||
DEFAULT_ROLE = "villager"
|
DEFAULT_ROLE = "villager"
|
||||||
|
17
wolfbot.py
17
wolfbot.py
@ -45,23 +45,6 @@ except ImportError:
|
|||||||
"- The lykos developers", sep="\n")
|
"- The lykos developers", sep="\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
try: # FIXME
|
|
||||||
botconfig.DEV_PREFIX
|
|
||||||
except AttributeError:
|
|
||||||
print("Please set up your config to include a DEV_PREFIX variable",
|
|
||||||
"If you have a prefix in your DEV_CHANNEL config, move it out into DEV_PREFIX",
|
|
||||||
sep="\n")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
try:
|
|
||||||
botconfig.USE_NICKSERV_GHOST
|
|
||||||
except AttributeError:
|
|
||||||
print("Please set up your config to include a USE_NICKSERV_GHOST variable",
|
|
||||||
"It should be a boolean value, determining whether to use GHOST or RELEASE",
|
|
||||||
"(See botconfig.py.example for an informative comment)",
|
|
||||||
sep="\n")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
from oyoyo.client import IRCClient
|
from oyoyo.client import IRCClient
|
||||||
|
|
||||||
import src
|
import src
|
||||||
|
Loading…
Reference in New Issue
Block a user