Пример #1
0
async def on_new_message(event):
    name = event.raw_text
    snips = sql.get_chat_blacklist(event.chat_id)
    for snip in snips:
        if snip == "küfür":
            for kufur in KUFURLER:
                pattern = r"( |^|[^\w])" + re.escape(kufur) + r"( |$|[^\w])"
                if re.search(pattern, name, flags=re.IGNORECASE):
                    try:
                        await event.delete()
                    except:
                        await event.reply(LANG['FORBIDDEN_KUFUR'])
                        sql.rm_from_blacklist(event.chat_id, "kufur")
                    break
                pass
            continue
        else:
            pattern = r"( |^|[^\w])" + re.escape(snip) + r"( |$|[^\w])"
            if re.search(pattern, name, flags=re.IGNORECASE):
                try:
                    await event.delete()
                except Exception as e:
                    await event.reply(LANG['HAVENT_PERMISSION'])
                    sql.rm_from_blacklist(event.chat_id, snip.lower())
                break
            pass
Пример #2
0
async def on_new_message(event):
    name = event.raw_text
    snips = sql.get_chat_blacklist(event.chat_id)
    reply_message = await event.get_reply_message()
    replied_user, error_i_a = await get_full_user(event)
    user_id = replied_user.user.id

    if replied_user.user.id in BRAIN_CHECKER or replied_user.user.id in WHITELIST:
        return
    for snip in snips:
        if snip == "küfür":
            for kufur in KUFURLER:
                pattern = r"( |^|[^\w])" + re.escape(kufur) + r"( |$|[^\w])"
                if re.search(pattern, name, flags=re.IGNORECASE):
                    try:
                        await event.delete()
                    except:
                        await event.reply(LANG['FORBIDDEN_KUFUR'])
                        sql.rm_from_blacklist(event.chat_id, "kufur")
                    break
                pass
            continue
        else:
            pattern = r"( |^|[^\w])" + re.escape(snip) + r"( |$|[^\w])"
            if re.search(pattern, name, flags=re.IGNORECASE):
                try:
                    await event.delete()
                except Exception as e:
                    await event.reply(LANG['HAVENT_PERMISSION'])
                    sql.rm_from_blacklist(event.chat_id, snip.lower())
                break
            pass
Пример #3
0
async def on_new_message(event):
    name = event.raw_text
    snips = sql.get_chat_blacklist(event.chat_id)
    for snip in snips:
        if snip == "küfür":
            for kufur in KUFURLER:
                pattern = r"( |^|[^\w])" + re.escape(kufur) + r"( |$|[^\w])"
                if re.search(pattern, name, flags=re.IGNORECASE):
                    try:
                        await event.delete()
                    except Exception as e:
                        await event.reply(
                            "Bu grupta mesaj silme yetkim yok. Küfür filtresi devre dışı."
                        )
                        sql.rm_from_blacklist(event.chat_id, "kufur")
                    break
                pass
            continue
        else:
            pattern = r"( |^|[^\w])" + re.escape(snip) + r"( |$|[^\w])"
            if re.search(pattern, name, flags=re.IGNORECASE):
                try:
                    await event.delete()
                except Exception as e:
                    await event.reply("Mesaj silme yetkim yok!")
                    sql.rm_from_blacklist(event.chat_id, snip.lower())
                break
            pass
Пример #4
0
async def on_view_blacklist(event):
    all_blacklisted = sql.get_chat_blacklist(event.chat_id)
    OUT_STR = "Blacklists in the Current Chat:\n"
    if len(all_blacklisted) > 0:
        for trigger in all_blacklisted:
            OUT_STR += f"👉 {trigger} \n"
    else:
        OUT_STR = "No BlackLists. Start Saving using `.addblacklist`"    
    await event.edit(OUT_STR)
Пример #5
0
async def on_new_message(event):
    # TODO: exempt admins from locks
    name = event.raw_text
    snips = sql.get_chat_blacklist(event.chat_id)
    for snip in snips:
        pattern = r"( |^|[^\w])" + re.escape(snip) + r"( |$|[^\w])"
        if re.search(pattern, name, flags=re.IGNORECASE):
            try:
                await event.delete()
            except Exception:
                await event.reply("I do not have DELETE permission in this chat")
                sql.rm_from_blacklist(event.chat_id, snip.lower())
            break
Пример #6
0
async def on_new_message(event):
    # TODO: exempt admins from locks
    name = event.raw_text
    snips = sql.get_chat_blacklist(event.chat_id)
    for snip in snips:
        pattern = r"( |^|[^\w])" + re.escape(snip) + r"( |$|[^\w])"
        if re.search(pattern, name, flags=re.IGNORECASE):
            try:
                await event.delete()
            except Exception:
                await event.reply(
                    "Saya tidak memiliki izin HAPUS dalam obrolan ini")
                sql.rm_from_blacklist(event.chat_id, snip.lower())
            break
Пример #7
0
async def on_new_message(event):
    # TODO: exempt admins from locks
    name = event.raw_text
    snips = sql.get_chat_blacklist(event.chat_id)
    for snip in snips:
        pattern = r"( |^|[^\w])" + re.escape(snip) + r"( |$|[^\w])"
        if re.search(pattern, name, flags=re.IGNORECASE):
            try:
                await event.delete()
            except Exception:
                await event.reply("`Anda Tidak Punya Izin Untuk Menghapus Pesan Disini`")
                await sleep(1)
                await reply.delete()
                sql.rm_from_blacklist(event.chat_id, snip.lower())
            break
Пример #8
0
async def on_view_blacklist(listbl):
    all_blacklisted = sql.get_chat_blacklist(listbl.chat_id)
    OUT_STR = f"**{LANG['BLACKLIST']}**\n"
    if len(all_blacklisted) > 0:
        for trigger in all_blacklisted:
            OUT_STR += f"`{trigger}`\n"
    else:
        OUT_STR = LANG['NOT_FOUND']
    if len(OUT_STR) > 4096:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "blacklist.text"
            await listbl.client.send_file(listbl.chat_id,
                                          out_file,
                                          force_document=True,
                                          allow_cache=False,
                                          caption=LANG['BLACKLIST_FILE'],
                                          reply_to=listbl)
            await listbl.delete()
    else:
        await listbl.edit(OUT_STR)
Пример #9
0
async def on_view_blacklist(listbl):
    all_blacklisted = sql.get_chat_blacklist(listbl.chat_id)
    OUT_STR = "**Bu grup için ayarlanan karaliste:**\n"
    if len(all_blacklisted) > 0:
        for trigger in all_blacklisted:
            OUT_STR += f"`{trigger}`\n"
    else:
        OUT_STR = "**Karalisteye eklenmiş kelime bulunamadı..** `.addblacklist` **komutu ile ekleyebilirsin.**"
    if len(OUT_STR) > 4096:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "blacklist.text"
            await listbl.client.send_file(
                listbl.chat_id,
                out_file,
                force_document=True,
                allow_cache=False,
                caption="**Bu grup için ayarlanan karaliste:**",
                reply_to=listbl)
            await listbl.delete()
    else:
        await listbl.edit(OUT_STR)
Пример #10
0
async def on_view_blacklist(listbl):
    all_blacklisted = sql.get_chat_blacklist(listbl.chat_id)
    OUT_STR = "Blacklists in the Current Chat:\n"
    if len(all_blacklisted) > 0:
        for trigger in all_blacklisted:
            OUT_STR += f"`{trigger}`\n"
    else:
        OUT_STR = "`There are no blacklist in current chat.`"
    if len(OUT_STR) > 4096:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "blacklist.text"
            await listbl.client.send_file(
                listbl.chat_id,
                out_file,
                force_document=True,
                allow_cache=False,
                caption="BlackLists in the Current Chat",
                reply_to=listbl)
            await listbl.delete()
    else:
        await listbl.edit(OUT_STR)
Пример #11
0
async def on_view_blacklist(listbl):
    all_blacklisted = sql.get_chat_blacklist(listbl.chat_id)
    OUT_STR = "Blacklists in the Current Chat:\n"
    if len(all_blacklisted) > 0:
        for trigger in all_blacklisted:
            OUT_STR += f"`{trigger}`\n"
    else:
        OUT_STR = "**Tidak Ada Blacklist Dalam Obrolan Ini.**"
    if len(OUT_STR) > 4096:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "blacklist.text"
            await listbl.client.send_file(
                listbl.chat_id,
                out_file,
                force_document=True,
                allow_cache=False,
                caption="Blacklist Dalam Obrolan Ini",
                reply_to=listbl,
            )
            await listbl.delete()
    else:
        await edit_or_reply(listbl, OUT_STR)
Пример #12
0
async def on_view_blacklist(listbl):
    all_blacklisted = sql.get_chat_blacklist(listbl.chat_id)
    OUT_STR = "Daftar Hitam di Obrolan Saat Ini:\n"
    if len(all_blacklisted) > 0:
        for trigger in all_blacklisted:
            OUT_STR += f"`{trigger}`\n"
    else:
        OUT_STR = "Tidak Ada Daftar Hitam. Mulai Menyimpan menggunakan `.addbl`"
    if len(OUT_STR) > 4096:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "blacklist.text"
            await listbl.client.send_file(
                listbl.chat_id,
                out_file,
                force_document=True,
                allow_cache=False,
                caption="Daftar Hitam di Obrolan Saat Ini",
                reply_to=listbl,
            )
            await listbl.delete()
    else:
        await listbl.edit(OUT_STR)
Пример #13
0
async def on_view_blacklist(listbl):
    all_blacklisted = sql.get_chat_blacklist(listbl.chat_id)
    OUT_STR = "Listas negras no chat atual:\n"
    if len(all_blacklisted) > 0:
        for trigger in all_blacklisted:
            OUT_STR += f"`{trigger}`\n"
    else:
        OUT_STR = "Sem listas negras. Comece a salvar usando `.addbl`"
    if len(OUT_STR) > 4096:
        with io.BytesIO(str.encode(OUT_STR)) as out_file:
            out_file.name = "blacklist.text"
            await listbl.client.send_file(
                listbl.chat_id,
                out_file,
                force_document=True,
                allow_cache=False,
                caption="Listas negras no chat atual",
                reply_to=listbl,
            )
            await listbl.delete()
    else:
        await listbl.edit(OUT_STR)