Skip to content

Commit

Permalink
Merge branch 'main' into snyk-fix-033c7ac8916c9719287c204821b93120
Browse files Browse the repository at this point in the history
  • Loading branch information
Nubuki-all authored Apr 7, 2024
2 parents 2f2ecda + 8a34c09 commit b8bac0c
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 10 deletions.
9 changes: 9 additions & 0 deletions bot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,18 @@ class Runtime_Config:
# will slowly replace the Var_list class in utils.bot_utils
def __init__(self):
self.aria2 = None
self.cached_dl = False
self.display_additional_dl_info = True
self.docker_deployed = False
self.rss_ran_once = False
self.group_enc = False
self.only_owner_pm = False
self.pause_status = 0
self.paused = False
self.sas = False
self.sqs = False
self.started = False
self.temp_users = []


conf = Config()
Expand Down
5 changes: 3 additions & 2 deletions bot/utils/msg_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ async def report_encode_status(
msg_2_delete=None,
log_msg=None,
pyro_msg=False,
stdout=None,
exe_prefix="ffmpeg",
):
_dir, file = os.path.split(file)
Expand Down Expand Up @@ -351,8 +352,8 @@ async def report_encode_status(
if log_msg:
await log_msg.edit(reply, buttons=None)
er = stderr.decode()
# if stdout and (out := stdout):
# er + "\n" + out
if stdout and (out := stdout.decode()):
er += "\n" + out
error = None
msg_2_delete = msg_2_delete or msg
if len(er) > 4095 and not cancelled:
Expand Down
13 changes: 12 additions & 1 deletion bot/utils/rss_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ async def rss_monitor():
last_title = rss_d.entries[0]["title"]
if data["last_feed"] == last_link or data["last_title"] == last_title:
continue
if not _bot.rss_ran_once:
data["allow_rss_spam"] = True
feed_count = 0
feed_list = []
while True:
Expand All @@ -66,6 +68,9 @@ async def rss_monitor():
log(
e=f"Reached Max index no. {feed_count} for this feed: {title}. Maybe you need to use less RSS_DELAY to not miss some torrents"
)
if not data.get("allow_rss_spam"):
log(e="Due to spam prevention, RSS feed has been reset.")
feed_list = []
break
parse = True
for flist in data["inf"]:
Expand Down Expand Up @@ -94,7 +99,11 @@ async def rss_monitor():
await asyncio.sleep(1)
async with rss_dict_lock:
rss_dict[title].update(
{"last_feed": last_link, "last_title": last_title}
{
"allow_rss_spam": False,
"last_feed": last_link,
"last_title": last_title,
}
)
await save2db2(rss_dict, "rss")
log(e=f"Feed Name: {title}")
Expand All @@ -105,6 +114,8 @@ async def rss_monitor():
if all_paused:
scheduler.pause()
log(e="No active rss feed\nRss Monitor has been paused!")
elif not _bot.rss_ran_once:
_bot.rss_ran_once = True


async def fake_event_handler(event):
Expand Down
1 change: 1 addition & 0 deletions bot/workers/auto/transcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ async def thing():
sender_id,
out,
log_msg=op,
stdout=stdout,
exe_prefix=ffmpeg.split(maxsplit=1)[0],
)
if encode.process.returncode != 0:
Expand Down
1 change: 1 addition & 0 deletions bot/workers/handlers/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,7 @@ async def rss_editor(event, args, client):
if arg.p:
data["paused"] = True
elif arg.r:
data["allow_rss_spam"] = True
data["paused"] = False
if scheduler.state == 2:
scheduler.resume()
Expand Down
8 changes: 5 additions & 3 deletions bot/workers/handlers/stuff.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ async def up(event, args, client):
ist = dt.now()
msg = await reply_message(event, "…")
st = dt.now()
await edit_message(msg, "`Ping…`")
ed = dt.now()
ims = (st - ist).microseconds / 1000
msg1 = "**Pong! ——** `{}`__ms__"
st = dt.now()
await edit_message(msg, msg1.format(ims))
ed = dt.now()
ms = (ed - st).microseconds / 1000
await edit_message(msg, "**Pong!**\n`{}` __ms__, `{}` __ms__".format(ims, ms))
await edit_message(msg, f"1. {msg1.format(ims)}\n2. {msg1.format(ms)}")


async def status(event, args, client):
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ emoji-country-flag
feedparser
html_telegraph_poster
humanize
lxml[html_clean]
telethon
tgcrypto
psutil
Expand All @@ -17,11 +18,10 @@ pyrogram==2.0.106
#pyrogram==2.0.73
python-decouple
qbittorrent-api
quote
random_word
tzlocal
#Depreciating...
quote
certifi>=2023.7.22 # not directly required, pinned by Snyk to avoid a vulnerability
requests>=2.31.0 # not directly required, pinned by Snyk to avoid a vulnerability
#setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
dnspython>=2.6.0rc1 # not directly required, pinned by Snyk to avoid a vulnerability
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.2.0-beta.0.6.00 (beta)
v2.2.0-beta.0.6.23 (beta)

0 comments on commit b8bac0c

Please sign in to comment.