added nickserv auth

This commit is contained in:
jan6 2022-02-07 18:28:19 +02:00
parent d39b1fddbc
commit 526dca8c86
5 changed files with 29 additions and 15 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
venv venv
pass.txt
# ---> Python # ---> Python
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/

View File

@ -232,9 +232,10 @@ class Command:
loc = cmd.split("?")[0].strip() loc = cmd.split("?")[0].strip()
mf = "m" # celsius by default mf = "m" # celsius by default
if(len(cmd.split("?"))>=2): if len(cmd.split("?")) >= 2:
argsplit = cmd.split("?")[1].split() argsplit = cmd.split("?")[1].split()
if "f" in argsplit or "u" in argsplit: mf="u" #farenheit if "f" in argsplit or "u" in argsplit:
mf = "u" # farenheit
a = __import__("http.client").client.HTTPSConnection("wttr.in") a = __import__("http.client").client.HTTPSConnection("wttr.in")
a.request("GET", f"/{loc}?A&T&0&n&F&{mf}") a.request("GET", f"/{loc}?A&T&0&n&F&{mf}")
b = a.getresponse().read().decode("utf-8") b = a.getresponse().read().decode("utf-8")

View File

@ -10,8 +10,11 @@ class config:
host = "irc.libera.chat" host = "irc.libera.chat"
port = 6697 port = 6697
ssl = True ssl = True
nickserv_auth = True
# get password from secret file
nickserv_pass = open("pass.txt", "r").read().strip()
channel = "##jan6" channel = "##jan6"
autojoin = ["##share","#1337331"] autojoin = ["##share", "#1337331", "#opsec"]
class admin: class admin:
accounts = ["jan6"] accounts = ["jan6"]

View File

@ -79,6 +79,13 @@ def stuff(bot, sock):
send(f"PONG :{line.params[0]}") send(f"PONG :{line.params[0]}")
if mode == "init": if mode == "init":
if line.command == "NOTICE":
if line.source.startswith("NickServ!NickServ@"):
if config.server.nickserv_auth == True:
mesg(
f"IDENTIFY {config.self.nick} {config.server.nickserv_pass}",
line.source.split("!")[0],
)
if line.command == "433": if line.command == "433":
util.nick(config.self.nick + "_") util.nick(config.self.nick + "_")
if line.command == "376": if line.command == "376":

View File

@ -29,8 +29,10 @@ class YouTube:
h = m // 60 h = m // 60
m = round((m / 60 - h) * 60) m = round((m / 60 - h) * 60)
return f"{h}h {m}m {s}s" return f"{h}h {m}m {s}s"
elif h==0 and m==0 and s==0: return "LIVE" elif h == 0 and m == 0 and s == 0:
elif m==0 and s!=0: return f"{s}s" return "LIVE"
elif m == 0 and s != 0:
return f"{s}s"
else: else:
return f"{m}m {s}s" return f"{m}m {s}s"