Пример #1
0
async def on_snip_list(event):

    all_snips = get_all_filters(event.chat_id)

    OUT_STR = "Available Filters in the Current Chat:\n"

    if len(all_snips) > 0:

        for a_snip in all_snips:

            OUT_STR += f"👉 {a_snip.keyword} \n"

    else:

        OUT_STR = "No Filters. Start Saving using `.savefilter`"

    if len(OUT_STR) > 4096:

        with io.BytesIO(str.encode(OUT_STR)) as out_file:

            out_file.name = "filters.text"

            await bot.send_file(
                event.chat_id,
                out_file,
                force_document=True,
                allow_cache=False,
                caption="Available Filters in the Current Chat",
                reply_to=event)

            await event.delete()

    else:

        await event.edit(OUT_STR)
Пример #2
0
async def on_snip(event):
    global last_triggered_filters
    name = event.raw_text
    if event.chat_id in last_triggered_filters:
        if name in last_triggered_filters[event.chat_id]:
            # avoid userbot spam
            # "I demand rights for us bots, we are equal to you humans." -Henri Koivuneva (t.me/UserbotTesting/2698)
            return False
    snips = get_all_filters(event.chat_id)
    if snips:
        for snip in snips:
            pattern = r"( |^|[^\w])" + re.escape(snip.keyword) + r"( |$|[^\w])"
            if re.search(pattern, name, flags=re.IGNORECASE):
                if snip.snip_type == TYPE_PHOTO:
                    media = types.InputPhoto(int(snip.media_id),
                                             int(snip.media_access_hash),
                                             snip.media_file_reference)
                elif snip.snip_type == TYPE_DOCUMENT:
                    media = types.InputDocument(int(snip.media_id),
                                                int(snip.media_access_hash),
                                                snip.media_file_reference)
                else:
                    media = None
                message_id = event.message.id
                if event.reply_to_msg_id:
                    message_id = event.reply_to_msg_id
                await event.reply(snip.reply, file=media)
                if event.chat_id not in last_triggered_filters:
                    last_triggered_filters[event.chat_id] = []
                last_triggered_filters[event.chat_id].append(name)
                await asyncio.sleep(DELETE_TIMEOUT)
                last_triggered_filters[event.chat_id].remove(name)
Пример #3
0
async def on_snip_list(event):
    all_snips = get_all_filters(event.chat_id)
    OUT_STR = "الردود في المجموعة:\n"
    if len(all_snips) > 0:
        for a_snip in all_snips:
            OUT_STR += f"👉 {a_snip.keyword} \n"
    else:
        OUT_STR = "لا يوجد ردود."
    if len(OUT_STR) > 4096:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "filters.text"
            await bot.send_file(event.chat_id,
                                out_file,
                                force_document=True,
                                allow_cache=False,
                                caption="الردود في المجموعة",
                                reply_to=event)
            await event.delete()
    else:
        await event.edit(OUT_STR)
Пример #4
0
async def on_snip_list(event):
    all_snips = get_all_filters(event.chat_id)
    OUT_STR = "**Filtri in questa Chat:**\n"
    if len(all_snips) > 0:
        for a_snip in all_snips:
            OUT_STR += f"👉 {a_snip.keyword} \n"
    else:
        OUT_STR = "**Nessun filtro. Salvalo usando `.savefilter`**"
    if len(OUT_STR) > 4096:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "filters.text"
            await bot.send_file(event.chat_id,
                                out_file,
                                force_document=True,
                                allow_cache=False,
                                caption="**Filtri in questa Chat:**",
                                reply_to=event)
            await event.delete()
    else:
        await event.edit(OUT_STR)
Пример #5
0
async def on_snip_list(event):
    all_snips = get_all_filters(event.chat_id)
    OUT_STR = "Filtri disponibili nella chat:\n"
    if len(all_snips) > 0:
        for a_snip in all_snips:
            OUT_STR += f"👉 {a_snip.keyword} \n"
    else:
        OUT_STR = "No filtri, usa`.savefilter`"
    if len(OUT_STR) > 4096:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "filters.text"
            await bot.send_file(event.chat_id,
                                out_file,
                                force_document=True,
                                allow_cache=False,
                                caption="Filtri disponibili nella chat",
                                reply_to=event)
            await event.delete()
    else:
        await event.edit(OUT_STR)
Пример #6
0
async def on_snip_list(event):
    all_snips = get_all_filters(event.chat_id)
    OUT_STR = "Available Filters in the Current Chat:\n"
    if len(all_snips) > 0:
        for a_snip in all_snips:
            OUT_STR += f"👉 {a_snip.keyword} \n"
    else:
        OUT_STR = "⌔︙لاتوجد ردود 🚫 . لاضافه رد استخدم امر ( .وضع رد )"
    if len(OUT_STR) > 4096:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "filters.text"
            await bot.send_file(
                event.chat_id,
                out_file,
                force_document=True,
                allow_cache=False,
                caption="⌔︙المرشحات المتاحه في الدردشه الحاليه ✅",
                reply_to=event)
            await event.delete()
    else:
        await event.edit(OUT_STR)
Пример #7
0
async def on_snip_list(event):
    all_snips = get_all_filters(event.chat_id)
    OUT_STR = "Mevcut Sohbette Kullanılabilir Filtreler:\n"
    if len(all_snips) > 0:
        for a_snip in all_snips:
            OUT_STR += f"👉 {a_snip.keyword} \n"
    else:
        OUT_STR = "Filtre yok `.Savefilter` kullanarak Kaydetmeye başlayın"
    if len(OUT_STR) > 4096:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "filters.text"
            await bot.send_file(
                event.chat_id,
                out_file,
                force_document=True,
                allow_cache=False,
                caption="Mevcut Sohbette Kullanılabilir Filtreler",
                reply_to=event)
            await event.delete()
    else:
        await edit_or_reply(event, OUT_STR)
Пример #8
0
async def on_snip_list(event):
    all_snips = get_all_filters(event.chat_id)
    OUT_STR = "📄Filtri Disponibili in Questo Gruppo:\n"
    if len(all_snips) > 0:
        for a_snip in all_snips:
            OUT_STR += f"👉 {a_snip.keyword} \n"
    else:
        OUT_STR = "**📭No Filtri. Incomincia a salvarli con** `.savefilter`"
    if len(OUT_STR) > 4096:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "filters.text"
            await bot.send_file(
                event.chat_id,
                out_file,
                force_document=True,
                allow_cache=False,
                caption="**📄Filtri Disponibili in Questo Gruppo.**",
                reply_to=event)
            await event.delete()
    else:
        await event.edit(OUT_STR)
Пример #9
0
async def on_snip_list(event):
    indiaislove = await edit_or_reply(event, "Yüklənir....")
    all_snips = get_all_filters(event.chat_id)
    OUT_STR = "Bu Chatdakı Aktiv Filterlər:\n"
    if len(all_snips) > 0:
        for a_snip in all_snips:
            OUT_STR += f"👉 {a_snip.keyword} \n"
    else:
        OUT_STR = "Filter Yoxdur. Sizdə Filter Yükləyin. Kod:`.savefilter`"
    if len(OUT_STR) > 4096:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "filters.text"
            await bot.send_file(
                event.chat_id,
                out_file,
                force_document=True,
                allow_cache=False,
                caption="Bu Chatdakı Aktiv Filterlər",
                reply_to=event,
            )
            await event.delete()
    else:
        await indiaislove.edit(OUT_STR)