Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #4
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
Beispiel #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(
                    "Saya tidak memiliki izin HAPUS dalam obrolan ini")
                sql.rm_from_blacklist(event.chat_id, snip.lower())
            break
Beispiel #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("`Anda Tidak Punya Izin Untuk Menghapus Pesan Disini`")
                await sleep(1)
                await reply.delete()
                sql.rm_from_blacklist(event.chat_id, snip.lower())
            break
Beispiel #7
0
async def on_delete_blacklist(rmbl):
    text = rmbl.pattern_match.group(1)
    to_unblacklist = list(set(trigger.strip() for trigger in text.split("\n") if trigger.strip()))
    successful = 0
    for trigger in to_unblacklist:
        if sql.rm_from_blacklist(rmbl.chat_id, trigger.lower()):
            successful += 1
    await rmbl.edit(f"**Kelime karalisteden kaldırıldı.**")
Beispiel #8
0
async def on_delete_blacklist(rmbl):
    text = rmbl.pattern_match.group(1)
    to_unblacklist = list(set(trigger.strip() for trigger in text.split("\n") if trigger.strip()))
    successful = 0
    for trigger in to_unblacklist:
        if sql.rm_from_blacklist(rmbl.chat_id, trigger.lower()):
            successful += 1
    await rmbl.edit(f"Removed {successful} / {len(to_unblacklist)} from the blacklist")
Beispiel #9
0
async def on_delete_blacklist(rmbl):
    text = rmbl.pattern_match.group(1)
    to_unblacklist = list(
        set(trigger.strip() for trigger in text.split("\n")
            if trigger.strip()))
    successful = 0
    for trigger in to_unblacklist:
        if sql.rm_from_blacklist(rmbl.chat_id, trigger.lower()):
            successful += 1
    await rmbl.edit(LANG['REMOVED'])
Beispiel #10
0
async def on_delete_blacklist(rmbl):
    text = rmbl.pattern_match.group(1)
    to_unblacklist = list(set(trigger.strip() for trigger in text.split("\n") if trigger.strip()))
    successful = 0
    for trigger in to_unblacklist:
        if sql.rm_from_blacklist(rmbl.chat_id, trigger.lower()):
            successful += 1
    if not successful:
        await rmbl.edit("`Blacklist` **{}** `doesn't exist.`".format(text))
    else:
        await rmbl.edit("`Blacklist` **{}** `was deleted successfully`".format(text))
Beispiel #11
0
async def kufur(event):
    kufur = event.pattern_match.group(1)
    if len(kufur) < 1:
        await event.edit(LANG['USAGE_KUFUR'])

    if kufur == "aç":
        sql.add_to_blacklist(event.chat_id, "küfür")
        await event.edit(LANG['OPENED_KUFUR'])
    elif kufur == "kapa":
        if sql.rm_from_blacklist(event.chat_id, "küfür"):
            await event.edit(LANG['CLOSED_KUFUR'])
        else:
            await event.edit(LANG['ALREADY_CLOSED_KUFUR'])
Beispiel #12
0
async def kufur(event):
    kufur = event.pattern_match.group(1)
    if len(kufur) < 1:
        await event.edit("`Kullanım: .küfür aç/kapa`")

    if kufur == "aç":
        sql.add_to_blacklist(event.chat_id, "küfür")
        await event.edit("`Küfür filtresi bu grup için açıldı!`")
    elif kufur == "kapa":
        if sql.rm_from_blacklist(event.chat_id, "küfür"):
            await event.edit("`Küfür filtresi bu grup için kapatıldı!`")
        else:
            await event.edit("`Bu grup için küfür filtresi zaten kapalı!`")
Beispiel #13
0
async def on_delete_blacklist(rmbl):
    text = rmbl.pattern_match.group(1)
    to_unblacklist = list(
        {trigger.strip()
         for trigger in text.split("\n") if trigger.strip()})
    successful = sum(
        bool(sql.rm_from_blacklist(rmbl.chat_id, trigger.lower()))
        for trigger in to_unblacklist)
    if not successful:
        await rmbl.edit("**{}** `Tidak Ada Di Blacklist`".format(text))
    else:
        await rmbl.edit(
            "`Berhasil Menghapus` **{}** `Di Blacklist`".format(text))
Beispiel #14
0
async def on_delete_blacklist(rmbl):
    text = rmbl.pattern_match.group(1)
    to_unblacklist = list(
        {trigger.strip() for trigger in text.split("\n") if trigger.strip()}
    )

    successful = 0
    for trigger in to_unblacklist:
        if sql.rm_from_blacklist(rmbl.chat_id, trigger.lower()):
            successful += 1
    if not successful:
        await rmbl.edit("`King,` **{}** `Tidak Ada Di Blacklist Tuan`".format(text))
    else:
        await rmbl.edit("`Sukses Menghapus` **{}** `Di Blacklist`".format(text))
Beispiel #15
0
async def on_delete_blacklist(rmbl):
    text = rmbl.pattern_match.group(1)
    to_unblacklist = list(
        {trigger.strip() for trigger in text.split("\n") if trigger.strip()}
    )

    successful = 0
    for trigger in to_unblacklist:
        if sql.rm_from_blacklist(rmbl.chat_id, trigger.lower()):
            successful += 1
    if not successful:
        await rmbl.edit("`Mohon Maaf,` **{}** `Tidak Ada Di Daftar Blacklist.`".format(text))
    else:
        await rmbl.edit("`Berhasil Menghapus` **{}** `Dari Daftar Blacklist`".format(text))
Beispiel #16
0
async def on_delete_blacklist(event):
    text = event.pattern_match.group(1)
    to_unblacklist = list(set(trigger.strip() for trigger in text.split("\n") if trigger.strip()))
    successful = 0
    for trigger in to_unblacklist:
        if sql.rm_from_blacklist(event.chat_id, trigger.lower()):
            successful += 1
    await event.edit(f"Removed {successful} / {len(to_unblacklist)} from the blacklist")

# Announce to the logging group if we have removed a blacklist successfully
    if BOTLOG:
        await event.client.send_message(
            BOTLOG_CHATID,
            "#RMBLACKLIST\n"
            f"TRIGGER: {trigger}\n"
            f"CHAT: {event.chat.title}(`{event.chat_id}`)"
        )