Add SERVER_PASS config to control PASS command

This commit is contained in:
skizzerz 2015-11-08 11:00:03 -06:00
parent 4e7b8ec6bb
commit a816b4b4ee
3 changed files with 15 additions and 3 deletions

View File

@ -12,6 +12,14 @@ CHANNEL = "##mywolfgame"
CMD_CHAR = "!"
# If your server requires a connection password, or your services package expects
# a different format if authenticating to NickServ via the PASS command, modify this.
# The default should work fine on Atheme-based services packages.
#
# Note: Do not put the account and password here; they will be automatically substituted
# from the USERNAME (or NICK) and PASS variables on the top of the file.
SERVER_PASS = "{account}:{password}"
OWNERS = ("unaffiliated/wolfbot_admin1",) # The comma is required at the end if there is only one owner.
ADMINS = ("unaffiliated/wolfbot_admin2", "unaffiliated/wolfbot_test*")

View File

@ -112,6 +112,7 @@ class IRCClient(object):
self.blocking = True
self.sasl_auth = False
self.use_ssl = False
self.server_pass = None
self.lock = threading.RLock()
self.stream_handler = lambda output, level=None: print(output)
@ -189,9 +190,11 @@ class IRCClient(object):
self.cap("LS", "302")
if not self.sasl_auth:
self.send("PASS {0}:{1}".format(self.authname if self.authname else self.nickname,
self.password if self.password else "NOPASS"))
if self.server_pass and (not self.sasl_auth or "{password}" not in self.server_pass):
message = "PASS :{0}".format(self.server_pass).format(
account=self.authname if self.authname else self.nickname,
password=self.password)
self.send(message)
self.nick(self.nickname)
self.user(self.ident, self.real_name)

View File

@ -46,6 +46,7 @@ def main():
ident=botconfig.IDENT,
real_name=botconfig.REALNAME,
sasl_auth=botconfig.SASL_AUTHENTICATION,
server_pass=botconfig.SERVER_PASS,
use_ssl=botconfig.USE_SSL,
connect_cb=handler.connect_callback,
stream_handler=src.stream,