fix self renaming a bit (every auth() will try to re-nick)

This commit is contained in:
jan6 2022-09-12 06:51:02 -07:00
parent e9636e8164
commit 8f34fd71a9
2 changed files with 11 additions and 3 deletions

View File

@ -13,12 +13,13 @@ class config:
nickserv_auth = True
# get password from secret file
nickserv_pass = open("pass.txt", "r").read().strip()
nickserv_recover = "RECOVER" #might be GHOST sometimes?
channel = "##jan6"
autojoin = ["##share", "#1337331"]
class admin:
accounts = ["jan6"]
hostmasks = ["jan6!jan6@mischievous.deity"]
hostmasks = ["jan6!jan6@mischievous.deity","jan6!~jan6@mischievous.deity"]
class cmd:
prefixes = ["6", "'"]

View File

@ -24,6 +24,7 @@ def stuff(bot, sock):
is_ctcp = False
is_pm = False
mode = "init"
nick_override=False
def auth(
nick=config.self.nick,
@ -34,12 +35,16 @@ def stuff(bot, sock):
# TODO: handle auth that isn't nickserv
if auth.lower() == "nickserv": # line.source.split("!")[0]
# TODO: on most network can probably do "PRIVMSG NickServ@services. :help"
# TODO: support actually checking the nickserv mask properly
if nickservmask == "NickServ":
try:
nickservmask = config.server.nickserv_mask
except:
True
util.mesg(f"IDENTIFY {nick} {passwd}", nickservmask)
nick_override=True
util.mesg(f"{config.server.nickserv_recover} {nick}", nickservmask)
send(irctokens.build("NICK", [config.self.nick]).format())
def configure():
config = importlib.reload(sys.modules["config"]).config
@ -99,7 +104,7 @@ def stuff(bot, sock):
if mode == "init":
if line.command == "NOTICE":
if line.source.startswith("NickServ!NickServ@"):
if line.source.startswith("NickServ!"):
if config.server.nickserv_auth == True:
auth()
# mesg(
@ -135,9 +140,11 @@ def stuff(bot, sock):
True
autojoin_done = True
elif mode == "normal":
if line.command == "433":
if line.command == "433" and nick_override!=False:
mesg("nick in use!", chan)
util.nick(config.self.nick)
nick_override=False
else: nick_override=False
if line.command == "INVITE":
send(irctokens.build("JOIN", [line.params[1]]).format())
elif line.command == "PRIVMSG":