diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 90cdac10..b23e3cda 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -1508,7 +1508,9 @@ class Client: sticker (``str``): Sticker to send. - Pass a file path as string to send a sticker that exists on your local machine. + Pass a file_id as string to send a sticker that exists on the Telegram servers, + pass an HTTP URL as a string for Telegram to get a .webp sticker file from the Internet, or + pass a file path as string to upload a new sticker that exists on your local machine. disable_notification (``bool``, optional): Sends the message silently. @@ -1529,25 +1531,55 @@ class Client: The size of the file. Returns: - On success, the sent Message is returned. + On success, the sent :obj:`Message ` is returned. Raises: :class:`Error ` """ - file = self.save_file(sticker, progress=progress) + file = None + + if os.path.exists(sticker): + file = self.save_file(sticker, progress=progress) + media = types.InputMediaUploadedDocument( + mime_type="image/webp", + file=file, + attributes=[ + types.DocumentAttributeFilename(os.path.basename(sticker)) + ] + ) + elif sticker.startswith("http"): + media = types.InputMediaDocumentExternal( + url=sticker + ) + else: + try: + decoded = utils.decode(sticker) + fmt = " 24 else "