Fix issues related to undernet (and in general)

- Now possible to use the bot without it having a registered account by
  blanking NICKSERV_IDENTIFY_COMMAND
- Now possible to configure who ChanServ is as well as the command it
  uses to op up in channel (blank to prevent it from auto-opping).
  Example configuration provided for undernet
- Properly autojoin channels even if there isn't an MOTD
This commit is contained in:
skizzerz 2015-07-28 22:35:47 -05:00
parent b4c5fc4188
commit dbb80a940e
4 changed files with 11 additions and 6 deletions

View File

@ -60,3 +60,5 @@ TIMESTAMP_FORMAT = "[%Y-%m-%d %H:%M:%S{tzoffset}]"
#NICKSERV_GHOST_COMMAND = ""
#NICKSERV_RELEASE_COMMAND = ""
#NICKSERV_REGAIN_COMMAND = ""
#CHANSERV = "x@channels.undernet.org"
#CHANSERV_OP_COMMAND = "OP {channel}"

View File

@ -273,7 +273,8 @@ class IRCClient(object):
def kick(self, chan, nick, msg=""):
self.send("KICK", chan, nick, ":"+msg)
def ns_identify(self, account, passwd, nickserv, command):
self.msg(nickserv, command.format(account=account, password=passwd))
if command:
self.msg(nickserv, command.format(account=account, password=passwd))
def ns_ghost(self, nickserv, command):
if command:
self.msg(nickserv, command.format(nick=self.nickname))

View File

@ -101,7 +101,9 @@ def unhandled(cli, prefix, cmd, *args):
notify_error(cli, botconfig.CHANNEL, log)
def connect_callback(cli):
def prepare_stuff(*args):
@hook("endofmotd", hookid=294)
@hook("nomotd", hookid=294)
def prepare_stuff(cli, *args):
# just in case we haven't managed to successfully auth yet
if not botconfig.SASL_AUTHENTICATION:
cli.ns_identify(botconfig.USERNAME or botconfig.NICK,
@ -119,15 +121,13 @@ def connect_callback(cli):
cli.join(",".join(channels))
cli.msg("ChanServ", "op " + botconfig.CHANNEL)
if var.CHANSERV_OP_COMMAND:
cli.msg(var.CHANSERV, var.CHANSERV_OP_COMMAND.format(channel=botconfig.CHANNEL))
cli.nick(botconfig.NICK) # very important (for regain/release)
wolfgame.connect_callback(cli)
prepare_stuff = hook("endofmotd", hookid=294)(prepare_stuff)
def mustregain(cli, *blah):
if not botconfig.PASS:
return

View File

@ -147,6 +147,8 @@ NICKSERV_IDENTIFY_COMMAND = "IDENTIFY {account} {password}"
NICKSERV_GHOST_COMMAND = "GHOST {nick}"
NICKSERV_RELEASE_COMMAND = "RELEASE {nick}"
NICKSERV_REGAIN_COMMAND = "REGAIN {nick}"
CHANSERV = "ChanServ"
CHANSERV_OP_COMMAND = "OP {channel}"
STASISED = defaultdict(int)
STASISED_ACCS = defaultdict(int)