From 9388c2647c2361b262f477e06d67dfe0436e09bc Mon Sep 17 00:00:00 2001 From: thedragonsinn <98635854+thedragonsinn@users.noreply.github.com> Date: Sat, 26 Apr 2025 15:21:56 +0530 Subject: [PATCH] `.gm`: fix link parsing on stories --- app/plugins/tg_tools/get_message.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/plugins/tg_tools/get_message.py b/app/plugins/tg_tools/get_message.py index a533f0d..731b757 100644 --- a/app/plugins/tg_tools/get_message.py +++ b/app/plugins/tg_tools/get_message.py @@ -7,7 +7,7 @@ def parse_link(link: str) -> tuple[int | str, int, int]: parsed_url: str = urlparse(link).path.strip("/") link_chunks = parsed_url.lstrip("c/").split("/") - thread = 0 + thread = "0" if len(link_chunks) == 3: chat, thread, message = link_chunks else: @@ -16,7 +16,10 @@ def parse_link(link: str) -> tuple[int | str, int, int]: if chat.isdigit(): chat = int(f"-100{chat}") - return chat, int(thread), int(message) + if thread.isdigit(): + thread = int(thread) + + return chat, thread, int(message) @BOT.add_cmd(cmd="gm")