Added nickserv authentication support
This commit is contained in:
parent
1fca73b946
commit
79fc1643cc
2 changed files with 14 additions and 11 deletions
|
@ -1,11 +1,11 @@
|
||||||
[irc]
|
[irc]
|
||||||
server = irc.freenode.net
|
server = irc.freenode.net
|
||||||
port = 6667
|
port = 6667
|
||||||
|
server_password = password
|
||||||
channels = #keryx
|
channels = #keryx
|
||||||
nick = Timber
|
|
||||||
|
|
||||||
# This your nick identification password
|
nick = Timber
|
||||||
password = testing
|
nick_password = password
|
||||||
|
|
||||||
# Comma separated list of owner nicks
|
# Comma separated list of owner nicks
|
||||||
owners = excid3
|
owners = excid3
|
||||||
|
|
19
logbot.py
19
logbot.py
|
@ -66,11 +66,12 @@ def gen_color(user):
|
||||||
|
|
||||||
|
|
||||||
class LogBot(SingleServerIRCBot):
|
class LogBot(SingleServerIRCBot):
|
||||||
def __init__(self, server, port, channels, owners, nickname, password):
|
def __init__(self, server, port, server_pass, channels, owners, nickname, nick_pass):
|
||||||
"""Initialize this badboy"""
|
"""Initialize this badboy"""
|
||||||
SingleServerIRCBot.__init__(self, [(server, port, password)],
|
SingleServerIRCBot.__init__(self, [(server, port, server_pass)],
|
||||||
nickname,
|
nickname,
|
||||||
nickname)
|
nickname)
|
||||||
|
self.nick_pass = nick_pass
|
||||||
self.chans = channels
|
self.chans = channels
|
||||||
|
|
||||||
def set_format(self, folder, format, stylesheet):
|
def set_format(self, folder, format, stylesheet):
|
||||||
|
@ -84,6 +85,8 @@ class LogBot(SingleServerIRCBot):
|
||||||
|
|
||||||
def on_welcome(self, c, e):
|
def on_welcome(self, c, e):
|
||||||
"""Join the channels once we have made a successful connection"""
|
"""Join the channels once we have made a successful connection"""
|
||||||
|
if self.nick_pass:
|
||||||
|
c.privmsg("nickserv", "identify %s" % self.nick_pass)
|
||||||
for channel in self.chans:
|
for channel in self.chans:
|
||||||
c.join(channel)
|
c.join(channel)
|
||||||
|
|
||||||
|
@ -243,11 +246,11 @@ def main(conf):
|
||||||
port = CONFIG.getint("irc", "port")
|
port = CONFIG.getint("irc", "port")
|
||||||
channels = CONFIG.get("irc", "channels").split(",")
|
channels = CONFIG.get("irc", "channels").split(",")
|
||||||
nick = CONFIG.get("irc", "nick")
|
nick = CONFIG.get("irc", "nick")
|
||||||
try:
|
try: server_pass = CONFIG.get("irc", "server_password")
|
||||||
password = CONFIG.get("irc", "password")
|
except: server_pass = None
|
||||||
except:
|
try: nick_pass = CONFIG.get("irc", "nick_password")
|
||||||
password = None
|
except: nick_pass = None
|
||||||
owner = CONFIG.get("irc", "owners").split(",")
|
owner = [x.strip() for x in CONFIG.get("irc", "owners").split(",")]
|
||||||
|
|
||||||
# Get the log section
|
# Get the log section
|
||||||
folder = CONFIG.get("log", "folder")
|
folder = CONFIG.get("log", "folder")
|
||||||
|
@ -260,7 +263,7 @@ def main(conf):
|
||||||
for type in types:
|
for type in types:
|
||||||
format[type] = CONFIG.get("format", type)
|
format[type] = CONFIG.get("format", type)
|
||||||
|
|
||||||
bot = LogBot(server, port, channels, owner, nick, password)
|
bot = LogBot(server, port, server_pass, channels, owner, nick, nick_pass)
|
||||||
bot.set_format(folder, format, stylesheet)
|
bot.set_format(folder, format, stylesheet)
|
||||||
bot.start()
|
bot.start()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue