2017-07-12 09:00:27 +00:00
|
|
|
import base64
|
2018-07-15 22:56:06 +00:00
|
|
|
import EventManager
|
2016-03-29 11:56:58 +00:00
|
|
|
|
|
|
|
class Module(object):
|
2016-05-17 13:52:07 +00:00
|
|
|
def __init__(self, bot):
|
|
|
|
bot.events.on("received").on("numeric").on("001"
|
2018-07-15 22:56:06 +00:00
|
|
|
).hook(self.on_connect, priority=EventManager.PRIORITY_URGENT)
|
2016-05-17 13:52:07 +00:00
|
|
|
bot.events.on("received").on("command").on("setnickserv"
|
|
|
|
).hook(self.set_nickserv, min_args=1, permission="setnickserv",
|
|
|
|
help="Set bot's nickserv password", usage="<password>",
|
|
|
|
private_only=True)
|
|
|
|
|
|
|
|
def on_connect(self, event):
|
|
|
|
nickserv_password = event["server"].get_setting(
|
|
|
|
"nickserv-password")
|
2018-07-15 22:56:06 +00:00
|
|
|
if nickserv_password:
|
2017-07-12 09:00:27 +00:00
|
|
|
event["server"].attempted_auth = True
|
2016-05-17 13:52:07 +00:00
|
|
|
event["server"].send_message("nickserv",
|
|
|
|
"identify %s" % nickserv_password)
|
|
|
|
|
|
|
|
def set_nickserv(self, event):
|
|
|
|
nickserv_password = event["args"]
|
|
|
|
event["server"].set_setting("nickserv-password", nickserv_password)
|
|
|
|
event["stdout"].write("Nickserv password saved")
|