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
pass.txt
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/

View File

@ -228,15 +228,16 @@ class Command:
@cmd
def weather(self, prefix, cmd, pm, line, admin, mesg):
"""crude weather command"""
cmd=" ".join(cmd.split(" ", 1)[1:])
loc=cmd.split("?")[0].strip()
cmd = " ".join(cmd.split(" ", 1)[1:])
loc = cmd.split("?")[0].strip()
mf="m" #celsius by default
if(len(cmd.split("?"))>=2):
argsplit=cmd.split("?")[1].split()
if "f" in argsplit or "u" in argsplit: mf="u" #farenheit
a=__import__("http.client").client.HTTPSConnection("wttr.in")
a.request("GET",f"/{loc}?A&T&0&n&F&{mf}")
b=a.getresponse().read().decode("utf-8")
mf = "m" # celsius by default
if len(cmd.split("?")) >= 2:
argsplit = cmd.split("?")[1].split()
if "f" in argsplit or "u" in argsplit:
mf = "u" # farenheit
a = __import__("http.client").client.HTTPSConnection("wttr.in")
a.request("GET", f"/{loc}?A&T&0&n&F&{mf}")
b = a.getresponse().read().decode("utf-8")
mesg(" ".join(b.split("\n")[3].strip().split(" ")[-2:]))
#mesg(cmd.split(" ", 1)[1])
# mesg(cmd.split(" ", 1)[1])

View File

@ -1,7 +1,7 @@
class config:
class self:
nick = "bot6"
username = "jan6_bot" #you can set it to your username
username = "jan6_bot" # you can set it to your username
realname = "jan6's bot"
source = "https://tildegit.org/jan6/bot6"
@ -10,8 +10,11 @@ class config:
host = "irc.libera.chat"
port = 6697
ssl = True
nickserv_auth = True
# get password from secret file
nickserv_pass = open("pass.txt", "r").read().strip()
channel = "##jan6"
autojoin = ["##share","#1337331"]
autojoin = ["##share", "#1337331", "#opsec"]
class admin:
accounts = ["jan6"]

View File

@ -79,6 +79,13 @@ def stuff(bot, sock):
send(f"PONG :{line.params[0]}")
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":
util.nick(config.self.nick + "_")
if line.command == "376":

View File

@ -29,13 +29,15 @@ class YouTube:
h = m // 60
m = round((m / 60 - h) * 60)
return f"{h}h {m}m {s}s"
elif h==0 and m==0 and s==0: return "LIVE"
elif m==0 and s!=0: return f"{s}s"
elif h == 0 and m == 0 and s == 0:
return "LIVE"
elif m == 0 and s != 0:
return f"{s}s"
else:
return f"{m}m {s}s"
def yt(self, url):
url=url.rstrip("\x01")
url = url.rstrip("\x01")
global y, z
y, z = {}, {}
p = self.parseprop()