From 4272454f9a7f6478b97af1c530bb048fc720bc6d Mon Sep 17 00:00:00 2001 From: YoursFunny Date: Sun, 24 Mar 2024 22:33:36 +0800 Subject: [PATCH] fix url match --- main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index d2f0d33..784a98e 100644 --- a/main.py +++ b/main.py @@ -85,8 +85,9 @@ async def edit_message(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No if update.message.reply_to_message != context.user_data['message_reply']: return update_text = update.message.text - match = common.message_url_regex.search(update_text).span() + match = common.message_url_regex.search(update_text) if match: + match = match.span() update_text = update_text[:match[0]] + '{1}'.format( context.user_data['message_url'], update_text[match[0] + 1:match[1] - 1] ) + update_text[match[1]:]