Reject animated stickers
This commit is contained in:
parent
71fb7c1051
commit
0b2b204232
|
@ -6,6 +6,7 @@ from decimal import Decimal
|
|||
from urllib.parse import urlparse, urlunparse, parse_qs, quote as urlencode
|
||||
from bs4 import BeautifulSoup
|
||||
from pyrogram import Client, filters
|
||||
from pyrogram.types import Sticker
|
||||
from .. import config, help_dict, log_errors, public_log_errors, session, get_file_mimetype, progress_callback, get_file_ext
|
||||
|
||||
async def download_file(url, filename, referer=None):
|
||||
|
@ -34,6 +35,9 @@ async def saucenao(client, message):
|
|||
if not media:
|
||||
await message.reply_text('Photo or GIF or Video or Sticker required')
|
||||
return
|
||||
if isinstance(media, Sticker) and sticker.is_animated:
|
||||
await message.reply_text('No animated stickers')
|
||||
return
|
||||
with tempfile.TemporaryDirectory() as tempdir:
|
||||
reply = await message.reply_text('Downloading...')
|
||||
filename = await client.download_media(media, file_name=os.path.join(tempdir, '0'), progress=progress_callback, progress_args=(reply, 'Downloading...', False))
|
||||
|
|
|
@ -7,6 +7,7 @@ import tempfile
|
|||
from decimal import Decimal
|
||||
from urllib.parse import quote as urlencode
|
||||
from pyrogram import Client, filters
|
||||
from pyrogram.types import Sticker
|
||||
from .. import config, help_dict, log_errors, session, progress_callback, public_log_errors
|
||||
|
||||
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['trace', 'tracemoe', 'whatanime', 'wa', 'wait'], prefixes=config['config']['prefixes']))
|
||||
|
@ -21,6 +22,9 @@ async def whatanime(client, message):
|
|||
if not media:
|
||||
await message.reply_text('Photo or GIF or Video or Sticker required')
|
||||
return
|
||||
if isinstance(media, Sticker) and sticker.is_animated:
|
||||
await message.reply_text('No animated stickers')
|
||||
return
|
||||
with tempfile.TemporaryDirectory() as tempdir:
|
||||
reply = await message.reply_text('Downloading...')
|
||||
path = await client.download_media(media, file_name=os.path.join(tempdir, '0'), progress=progress_callback, progress_args=(reply, 'Downloading...', False))
|
||||
|
|
Loading…
Reference in New Issue