mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 21:07:59 +00:00
Add support for sending messages using joinchat links and hashes
This commit is contained in:
parent
1da39efa2e
commit
b45f2f4595
@ -23,6 +23,7 @@ import math
|
||||
import mimetypes
|
||||
import os
|
||||
import re
|
||||
import struct
|
||||
import threading
|
||||
import time
|
||||
from collections import namedtuple
|
||||
@ -916,6 +917,12 @@ class Client:
|
||||
if peer_id in ("self", "me"):
|
||||
return InputPeerSelf()
|
||||
|
||||
match = self.INVITE_LINK_RE.match(peer_id)
|
||||
|
||||
if match:
|
||||
decoded = base64.b64decode(match.group(1) + "=" * (-len(match.group(1)) % 4), altchars="-_")
|
||||
return self.resolve_peer(struct.unpack(">2iq", decoded)[1])
|
||||
|
||||
peer_id = peer_id.lower().strip("@+")
|
||||
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user