Skip to content

Commit

Permalink
Properly support queuing on topics
Browse files Browse the repository at this point in the history
  • Loading branch information
Nubuki-all committed Dec 16, 2024
1 parent 4f09237 commit e7f9f94
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions bot/workers/handlers/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ async def enleech(event, args: str, client, direct=False):
mode = "None"
o_args = None
queue = get_queue()
topic_id = None
invalid_msg = "`Invalid torrent/direct link`"
no_uri_msg = (
"`uhm you need to reply to or send command alongside a uri/direct link`"
Expand Down Expand Up @@ -230,8 +231,14 @@ async def enleech(event, args: str, client, direct=False):
anilist = flag.da
cust_v = flag.v
force_name = flag.n
if getattr(event.reply_to, "forum_topic", None):
topic_id = (
top
if (top := event.reply_to.reply_to_top_id)
else event.reply_to_msg_id
)
try:
if event.is_reply and not direct:
if event.is_reply and not direct and topic_id != event.reply_to_msg_id:
rep_event = await event.get_reply_message()
if rep_event.file:
await event.reply("**Warning:** `Use /add for files instead.`")
Expand Down Expand Up @@ -397,6 +404,7 @@ async def enleech2(event, args: str, client, direct=False):
no_bt_spt_msg = "`Torrent is a batch torrent.\nTo add to queue use -b`"
no_fl_spt_msg = "`File is not a video.`"
or_event = event
topic_id = None
if args:
flag, args = get_args(
"-d",
Expand Down Expand Up @@ -425,8 +433,14 @@ async def enleech2(event, args: str, client, direct=False):
force_name = flag.n
if flag.s and not flag.s.isdigit():
return await event.reply("`Value for '-s' arg has to be digit.`")
if getattr(event.reply_to, "forum_topic", None):
topic_id = (
top
if (top := event.reply_to.reply_to_top_id)
else event.reply_to_msg_id
)
try:
if event.is_reply and not direct:
if event.is_reply and not direct and topic_id != event.reply_to_msg_id:
rep_event = await event.get_reply_message()
if rep_event.file:
return await event.reply("**Error:** `Use /add for files instead.`")
Expand Down

0 comments on commit e7f9f94

Please sign in to comment.