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.
This commit is contained in:
Danny Lin 2021-11-27 20:56:59 -08:00
parent 2e1be01ad4
commit a1b2364fc1
No known key found for this signature in database
GPG Key ID: 1988FAA1797EE5AC

View File

@ -54,7 +54,7 @@ mimetypes.add_type('audio/flac', '.flac')
mimetypes.add_type('application/x-tgsticker', '.tgs') mimetypes.add_type('application/x-tgsticker', '.tgs')
USERNAME_RE = re.compile( 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( TG_JOIN_RE = re.compile(
r'tg://(join)\?invite=' r'tg://(join)\?invite='