fix url match

This commit is contained in:
2024-03-24 22:33:36 +08:00
parent 7d289c9db7
commit 4272454f9a
+2 -1
View File
@@ -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']: if update.message.reply_to_message != context.user_data['message_reply']:
return return
update_text = update.message.text update_text = update.message.text
match = common.message_url_regex.search(update_text).span() match = common.message_url_regex.search(update_text)
if match: if match:
match = match.span()
update_text = update_text[:match[0]] + '<a href="{0}">{1}</a>'.format( update_text = update_text[:match[0]] + '<a href="{0}">{1}</a>'.format(
context.user_data['message_url'], update_text[match[0] + 1:match[1] - 1] context.user_data['message_url'], update_text[match[0] + 1:match[1] - 1]
) + update_text[match[1]:] ) + update_text[match[1]:]