|
@@ -23,13 +23,16 @@ SOFTWARE.
|
|
|
"""
|
|
"""
|
|
|
import imghdr
|
|
import imghdr
|
|
|
import os
|
|
import os
|
|
|
|
|
+from asyncio import gather
|
|
|
from traceback import format_exc
|
|
from traceback import format_exc
|
|
|
|
|
|
|
|
from pyrogram import filters
|
|
from pyrogram import filters
|
|
|
-from pyrogram.errors.exceptions.bad_request_400 import (
|
|
|
|
|
- PeerIdInvalid, ShortnameOccupyFailed, StickerEmojiInvalid,
|
|
|
|
|
- StickerPngDimensions, StickerPngNopng, UserIsBlocked)
|
|
|
|
|
-from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
|
|
|
|
|
|
+from pyrogram.errors import (PeerIdInvalid, ShortnameOccupyFailed,
|
|
|
|
|
+ StickerEmojiInvalid,
|
|
|
|
|
+ StickerPngDimensions, StickerPngNopng,
|
|
|
|
|
+ UserIsBlocked)
|
|
|
|
|
+from pyrogram.types import (InlineKeyboardButton,
|
|
|
|
|
+ InlineKeyboardMarkup, Message)
|
|
|
|
|
|
|
|
from wbb import BOT_USERNAME, app
|
|
from wbb import BOT_USERNAME, app
|
|
|
from wbb.core.decorators.errors import capture_err
|
|
from wbb.core.decorators.errors import capture_err
|
|
@@ -41,8 +44,13 @@ from wbb.utils.stickerset import (add_sticker_to_set, create_sticker,
|
|
|
get_sticker_set_by_name)
|
|
get_sticker_set_by_name)
|
|
|
|
|
|
|
|
__MODULE__ = "Stickers"
|
|
__MODULE__ = "Stickers"
|
|
|
-__HELP__ = """/sticker_id - To Get File ID of A Sticker.
|
|
|
|
|
-/kang - To Kang A Sticker or Image."""
|
|
|
|
|
|
|
+__HELP__ = """
|
|
|
|
|
+/sticker_id
|
|
|
|
|
+ To get FileID of a Sticker.
|
|
|
|
|
+/get_sticker
|
|
|
|
|
+ To get sticker as a photo and document.
|
|
|
|
|
+/kang
|
|
|
|
|
+ To kang a Sticker or an Image."""
|
|
|
|
|
|
|
|
MAX_STICKERS = 120 # would be better if we could fetch this limit directly from telegram
|
|
MAX_STICKERS = 120 # would be better if we could fetch this limit directly from telegram
|
|
|
SUPPORTED_TYPES = ["jpeg", "png", "webp"]
|
|
SUPPORTED_TYPES = ["jpeg", "png", "webp"]
|
|
@@ -50,18 +58,46 @@ SUPPORTED_TYPES = ["jpeg", "png", "webp"]
|
|
|
|
|
|
|
|
@app.on_message(filters.command("sticker_id") & ~filters.edited)
|
|
@app.on_message(filters.command("sticker_id") & ~filters.edited)
|
|
|
@capture_err
|
|
@capture_err
|
|
|
-async def sticker_id(_, message):
|
|
|
|
|
- if not message.reply_to_message:
|
|
|
|
|
- return await message.reply_text("Reply to a sticker.")
|
|
|
|
|
- if not message.reply_to_message.sticker:
|
|
|
|
|
- return await message.reply_text("Reply to a sticker.")
|
|
|
|
|
- file_id = message.reply_to_message.sticker.file_id
|
|
|
|
|
- await message.reply_text(f"`{file_id}`")
|
|
|
|
|
|
|
+async def sticker_id(_, message: Message):
|
|
|
|
|
+ reply = message.reply_to_message
|
|
|
|
|
+
|
|
|
|
|
+ if not reply:
|
|
|
|
|
+ return await message.reply("Reply to a sticker.")
|
|
|
|
|
+
|
|
|
|
|
+ if not reply.sticker:
|
|
|
|
|
+ return await message.reply("Reply to a sticker.")
|
|
|
|
|
+
|
|
|
|
|
+ await message.reply_text(f"`{reply.sticker.file_id}`")
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+@app.on_message(filters.command("get_sticker") & ~filters.edited)
|
|
|
|
|
+@capture_err
|
|
|
|
|
+async def sticker_image(_, message: Message):
|
|
|
|
|
+ r = message.reply_to_message
|
|
|
|
|
+
|
|
|
|
|
+ if not r:
|
|
|
|
|
+ return await message.reply("Reply to a sticker.")
|
|
|
|
|
+
|
|
|
|
|
+ if not r.sticker:
|
|
|
|
|
+ return await message.reply("Reply to a sticker.")
|
|
|
|
|
+
|
|
|
|
|
+ m = await message.reply("Sending..")
|
|
|
|
|
+ f = await r.download(f"{r.sticker.file_unique_id}.png")
|
|
|
|
|
+
|
|
|
|
|
+ await gather(
|
|
|
|
|
+ *[
|
|
|
|
|
+ message.reply_photo(f),
|
|
|
|
|
+ message.reply_document(f),
|
|
|
|
|
+ ]
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ await m.delete()
|
|
|
|
|
+ os.remove(f)
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.on_message(filters.command("kang") & ~filters.edited)
|
|
@app.on_message(filters.command("kang") & ~filters.edited)
|
|
|
@capture_err
|
|
@capture_err
|
|
|
-async def kang(client, message):
|
|
|
|
|
|
|
+async def kang(client, message: Message):
|
|
|
if not message.reply_to_message:
|
|
if not message.reply_to_message:
|
|
|
return await message.reply_text(
|
|
return await message.reply_text(
|
|
|
"Reply to a sticker/image to kang it."
|
|
"Reply to a sticker/image to kang it."
|