Implement autojoin

This commit is contained in:
Mark Veidemanis 2017-11-25 19:48:20 +00:00
parent a673a2288e
commit ac798016ba
1 changed files with 6 additions and 0 deletions

View File

@ -55,6 +55,7 @@ class IRCBot(IRCClient):
self.versionNum = None self.versionNum = None
self.versionEnv = None self.versionEnv = None
self.sourceURL = instance["source"] self.sourceURL = instance["source"]
self.autojoin = instance["autojoin"]
self._who = {} self._who = {}
self._getWho = {} self._getWho = {}
@ -166,6 +167,8 @@ class IRCBot(IRCClient):
self.connected = True self.connected = True
if self.authtype == "ns": if self.authtype == "ns":
self.msg(self.authentity, "IDENTIFY %s" % self.nspass) self.msg(self.authentity, "IDENTIFY %s" % self.nspass)
for i in self.autojoin:
self.join(i)
def joined(self, channel): def joined(self, channel):
if not channel in self.channels: if not channel in self.channels:
@ -590,6 +593,7 @@ class Helper(object):
"finger": None, "finger": None,
"version": None, "version": None,
"source": None, "source": None,
"autojoin": [],
"authtype": config["Default"]["authtype"], "authtype": config["Default"]["authtype"],
"password": config["Default"]["password"], "password": config["Default"]["password"],
"authentity": "NickServ", "authentity": "NickServ",
@ -679,6 +683,8 @@ class Helper(object):
if spl[2] == "enabled": if spl[2] == "enabled":
failure("Use the enable and disable commands to manage this") failure("Use the enable and disable commands to manage this")
return return
if spl[2] == "autojoin":
spl[3] = spl[3].split(",")
pool[spl[1]][spl[2]] = spl[3] pool[spl[1]][spl[2]] = spl[3]
if spl[1] in IRCPool.keys(): if spl[1] in IRCPool.keys():