From a1b2364fc1326fd8956a94974e82b81d3331fc53 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Sat, 27 Nov 2021 20:56:59 -0800 Subject: [PATCH] Add support for new invite link format Recently, Telegram changed the invite link format for private groups so they look like t.me/+InviteHash instead of the old t.me/joinchat/InviteHash format, but the actual invite hashes are the same. Add support for the new "+" format to the username regex. --- telethon/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telethon/utils.py b/telethon/utils.py index e8c59c01..b83dd573 100644 --- a/telethon/utils.py +++ b/telethon/utils.py @@ -54,7 +54,7 @@ mimetypes.add_type('audio/flac', '.flac') mimetypes.add_type('application/x-tgsticker', '.tgs') USERNAME_RE = re.compile( - r'@|(?:https?://)?(?:www\.)?(?:telegram\.(?:me|dog)|t\.me)/(@|joinchat/)?' + r'@|(?:https?://)?(?:www\.)?(?:telegram\.(?:me|dog)|t\.me)/(@|\+|joinchat/)?' ) TG_JOIN_RE = re.compile( r'tg://(join)\?invite='