1
0
forked from jan6/bot6

Merge branch 'master' into getattr

This commit is contained in:
jan6 2024-05-20 16:50:54 +00:00
commit 44403e79c0
5 changed files with 32 additions and 16 deletions

View File

@ -182,17 +182,25 @@ class Command:
@adm
def crapdate(self, prefix, cmd, pm, line, admin, mesg):
"""hacky and crappy update command, don't use it, lol"""
args=cmd.split()[1:]
if not args:args=['']
popen=__import__("os").popen
# mesg(args)
if args[0] in ["log","list"]:
if len(args) == 1 : args=args+["",3]
elif len(args) < 3: args=args+["3"]
for i in popen(f"git log --pretty=oneline --abbrev-commit {args[1]}").read().split("\n",int(args[2])): mesg(i)
args = cmd.split()[1:]
if not args:
args = [""]
popen = __import__("os").popen
# mesg(args)
if args[0] in ["log", "list"]:
if len(args) == 1:
args = args + ["", 3]
elif len(args) < 3:
args = args + ["3"]
for i in (
popen(f"git log --pretty=oneline --abbrev-commit {args[1]}")
.read()
.split("\n", int(args[2]))
):
mesg(i)
else:
mesg(popen("git pull").read())
mesg(popen("git status|tr '\\n' ' '").read())
mesg(popen("git pull").read())
mesg(popen("git status|tr '\\n' ' '").read())
@adm
def dbg(self, prefix, cmd, pm, line, admin, mesg):

View File

@ -34,7 +34,7 @@ class config(config):
nickserv_recover = "RECOVER" # I recall it being GHOST on some networks?
channel = "#bots"
autojoin = ["#some-other", "##channels"]
blacklisted_channels=[]
blacklisted_channels = ["0"] # ngircd allows joining it, kills your connection
class admin:
# ircv3 account-tag based admin

View File

@ -1 +1 @@
ircstates ~=0.11.9
ircstates

View File

@ -162,7 +162,11 @@ def stuff(bot, sock):
else:
nick_override = False
if line.command == "INVITE":
send(irctokens.build("JOIN", [line.params[1]]).format()) if line.params[1] not in config.server.blacklisted_channels else None
send(
irctokens.build("JOIN", [line.params[1]]).format()
) if line.params[
1
] not in config.server.blacklisted_channels else None
elif line.command == "PRIVMSG":
if line.tags == None or "batch" not in line.tags:
is_pm = False

View File

@ -137,16 +137,20 @@ class YouTube:
global y, z
y, z = {}, {}
p = self.parseprop()
# use premature optimization? it should be SLIGHTLY faster
# use premature optimization? it should be SLIGHTLY faster, but can sometimes fail
data = b""
if self.premature_optimization:
url_h, data = urlopen(url), b""
url_h = urlopen(url)
# <body> appears on approximately line 21 or 22, so we read 24 lines to be safe (23-25 should be license comment)
# I tried to read byte amounts but it's hard to make sure no invalid utf8 bytes happen due to partial reads
for i in range(24):
data += url_h.readline()
data = data.decode() # bytes to utf-8
url_h.close()
else:
if (
data.find('meta itemprop="duration"') == -1
or data.find('meta itemprop="name"') == -1
): # acts as both fallback for optimization, and in case optimization's turned off
# just read all of the html
data = urlopen(url).read().decode()
# print(f"\x1b[31m my data is: {data}\x1b[0m")