Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@pyrogram.Client.on_message(pyrogram.Filters.sticker)
async def DownloadStickersBot(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "DownloadStickersBot")
logger.info(update.from_user)
download_location = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + "_DownloadStickersBot_" + str(update.from_user.id) + ".png"
a = await bot.send_message(
chat_id=update.chat.id,
text=Translation.DOWNLOAD_START,
reply_to_message_id=update.message_id
)
@pyrogram.Client.on_message(pyrogram.Filters.command(["downloadmedia"]))
async def download_media(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "downloadmedia")
saved_file_path = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + ".FFMpegRoBot.mkv"
if not os.path.exists(saved_file_path):
a = await bot.send_message(
chat_id=update.chat.id,
text=Translation.DOWNLOAD_START,
reply_to_message_id=update.message_id
)
@Client.on_message(Filters.command("eval", prefix="!"))
def eval_expression(client, message):
expression = " ".join(message.command[1:])
if expression:
m = message.reply(RUNNING.format(expression))
try:
result = eval(expression)
except Exception as error:
client.edit_message_text(
m.chat.id,
m.message_id,
ERROR.format(expression, error)
)
else:
if result is None:
@pyrogram.Client.on_message(pyrogram.Filters.command(["unzip"]))
async def unzip(bot, update):
if update.from_user.id not in Config.AUTH_USERS:
await bot.delete_messages(
chat_id=update.chat.id,
message_ids=update.message_id,
revoke=True
)
return
TRChatBase(update.from_user.id, update.text, "unzip")
saved_file_path = Config.DOWNLOAD_LOCATION + \
"/" + str(update.from_user.id) + ".unzip.zip"
if os.path.exists(saved_file_path):
os.remove(saved_file_path)
reply_message = update.reply_to_message
if ((reply_message is not None) and
(reply_message.document is not None) and
Args:
command (``str``):
The pattern you want to use, excluding the prefix.
prefix (``str``, optional):
If you want to change the default prefix set.
Defaults to "[!.#]".
group (``int``, optional):
The group to use for the message handler. Defaults to 0.
"""
filters = (
Filters.outgoing &
Filters.regex(f"(?i)^{prefix}{command}")
)
return Client.on_message(filters, group)