How to use the pyrogram.Filters.command function in Pyrogram

To help you get started, we’ve selected a few Pyrogram examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SpEcHiDe / AnyDLBot / plugins / rename_file.py View on Github external
@pyrogram.Client.on_message(pyrogram.Filters.command(["rename"]))
async def rename_doc(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, "rename")
    if (" " in update.text) and (update.reply_to_message is not None):
        cmd, file_name = update.text.split(" ", 1)
        description = Translation.CUSTOM_CAPTION_UL_FILE
        download_location = Config.DOWNLOAD_LOCATION + "/"
        a = await bot.send_message(
            chat_id=update.chat.id,
            text=Translation.DOWNLOAD_START,
github pyrogram / plugins / plugins / replace / replace.py View on Github external
@Client.on_message(Filters.command("r", prefix="!") & Filters.reply & ~Filters.edited & Filters.group)
def r(client, message):
    if len(message.command) > 1:
        colength = len("r") + len("!")
        query = str(message.text)[colength:].lstrip()
        eventsplit=query.split("/")
        result="**You mean:**\n{}".format(message.reply_to_message.text.replace(eventsplit[0],eventsplit[1]))
        client.edit_message_text(message.chat.id, message.message_id, result)
github SpEcHiDe / AnyDLBot / plugins / extract_streams.py View on Github external
@pyrogram.Client.on_message(pyrogram.Filters.command(["extractstreams"]))
async def extract_sub_title(bot, update):
    TRChatBase(update.from_user.id, update.text, "extract_st_reams")
    if str(update.from_user.id) not in Config.SUPER7X_DLBOT_USERS:
        await bot.send_message(
            chat_id=update.chat.id,
            text=Translation.NOT_AUTH_USER_TEXT,
            reply_to_message_id=update.message_id
        )
        return
    if update.reply_to_message is not None:
        download_location = Config.DOWNLOAD_LOCATION + "/"
        a = await bot.send_message(
            chat_id=update.chat.id,
            text=Translation.DOWNLOAD_START,
            reply_to_message_id=update.message_id
        )
github SpEcHiDe / AnyDLBot / plugins / generate_screen_shot.py View on Github external
@pyrogram.Client.on_message(pyrogram.Filters.command(["generatescss"]))
async def generate_screen_shot(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, "generatescss")
    if update.reply_to_message is not None:
        download_location = Config.DOWNLOAD_LOCATION + "/"
        a = await bot.send_message(
            chat_id=update.chat.id,
            text=Translation.DOWNLOAD_START,
            reply_to_message_id=update.message_id
        )
github SpEcHiDe / AnyDLBot / plugins / get_external_link.py View on Github external
@pyrogram.Client.on_message(pyrogram.Filters.command(["getlink"]))
async def get_link(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, "getlink")
    logger.info(update.from_user)
    if update.reply_to_message is not None:
        reply_message = update.reply_to_message
        download_location = Config.DOWNLOAD_LOCATION + "/"
        start = datetime.now()
        a = await bot.send_message(
            chat_id=update.chat.id,
github SpEcHiDe / AnyDLBot / plugins / convert_to_video.py View on Github external
@pyrogram.Client.on_message(pyrogram.Filters.command(["converttovideo"]))
async def convert_to_video(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, "converttovideo")
    if update.reply_to_message is not None:
        description = Translation.CUSTOM_CAPTION_UL_FILE
        download_location = Config.DOWNLOAD_LOCATION + "/"
        a = await bot.send_message(
            chat_id=update.chat.id,
            text=Translation.DOWNLOAD_START,
            reply_to_message_id=update.message_id
github SpEcHiDe / AnyDLBot / plugins / convert_to_audio.py View on Github external
@pyrogram.Client.on_message(pyrogram.Filters.command(["converttoaudio"]))
async def convert_to_audio(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, "converttoaudio")
    if (update.reply_to_message is not None) and (update.reply_to_message.media is not None) :
        description = Translation.CUSTOM_CAPTION_UL_FILE
        download_location = Config.DOWNLOAD_LOCATION + "/"
        a = await bot.send_message(
            chat_id=update.chat.id,
            text=Translation.DOWNLOAD_START,
            reply_to_message_id=update.message_id
github SpEcHiDe / AnyDLBot / plugins / extract_sub_title.py View on Github external
@pyrogram.Client.on_message(pyrogram.Filters.command(["extractsubtitle"]))
def extract_sub_title(bot, update):
    TRChatBase(update.from_user.id, update.text, "extract_sub_title")
    if str(update.from_user.id) not in Config.SUPER7X_DLBOT_USERS:
        bot.send_message(
            chat_id=update.chat.id,
            text=Translation.NOT_AUTH_USER_TEXT,
            reply_to_message_id=update.message_id
        )
        return
    download_location = Config.DOWNLOAD_LOCATION + "/"
    if update.reply_to_message is not None:
        text = update.reply_to_message.text
        if text is not None and text.startswith("http"):
            a = bot.send_message(
                chat_id=update.chat.id,
                text=Translation.UPLOAD_START,
github SpEcHiDe / AnyDLBot / plugins / custom_thumbnail.py View on Github external
@pyrogram.Client.on_message(pyrogram.Filters.command(["generatecustomthumbnail"]))
async def generate_custom_thumbnail(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, "generatecustomthumbnail")
    if update.reply_to_message is not None:
        reply_message = update.reply_to_message
        if reply_message.media_group_id is not None:
            download_location = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + "/" + str(reply_message.media_group_id) + "/"
            save_final_image = download_location + str(round(time.time())) + ".jpg"
            list_im = os.listdir(download_location)
            if len(list_im) == 2: