示例#1
0
async def mention_afk(mention):
    """ This function takes care of notifying the
     people who mention you that you are AFK."""

    global COUNT_MSG
    global USERS
    if not is_redis_alive():
        return
    AFK = await is_afk()
    if mention.message.mentioned and not (
            await mention.get_sender()).bot and str(
                mention.chat_id) not in AFK_IGNORE_CHATS:
        if AFK is True:
            if mention.sender_id not in USERS:
                await mention.reply(
                    "What? I'm ded due to ```" + await afk_reason() +
                    "```\nI'll get back to you once i'm alive."
                    "\n\n`This is an auto-generated reply by my bot`.")
                USERS.update({mention.sender_id: 1})
                COUNT_MSG = COUNT_MSG + 1
            elif mention.sender_id in USERS:
                if USERS[mention.
                         sender_id] == 5 or USERS[mention.sender_id] >= 16:
                    await mention.reply(
                        "But i'm still ded."
                        "\nStop spamming me smh."
                        "\nI'm busy with ```" + await afk_reason() +
                        "\n\n`This is an auto-generated reply by my bot`.")
                    USERS[mention.sender_id] = USERS[mention.sender_id] + 1
                    COUNT_MSG = COUNT_MSG + 1
                elif USERS[mention.sender_id] == 10:
                    await mention.reply(
                        "This is my final warning!"
                        "\nSTOP or i'll F u you."
                        "\n\n`This is an auto-generated reply by my bot`.")
                    USERS[mention.sender_id] = USERS[mention.sender_id] + 1
                    COUNT_MSG = COUNT_MSG + 1
                elif USERS[mention.sender_id] == 15:
                    await mention.reply(
                        "Enuf tard that's it you're blocked !"
                        "\nDoi"
                        "\n\n`This is an auto-generated reply by my bot`.")
                    """ Block the chat """
                    await mention.client(BlockRequest(mention.sender_id))
                    aname = await mention.client.get_entity(mention.sender_id)
                    name0 = str(aname.first_name)
                    uid = mention.sender_id

                    if not is_mongo_alive() or not is_redis_alive():
                        await mention.edit("`Database connections failing!`")
                        return

                    if BOTLOG:
                        await mention.client.send_message(
                            BOTLOG_CHATID,
                            "#BLOCKED\n" + "User: "******"[{name0}](tg://user?id={uid})",
                        )

                    USERS[mention.sender_id] = USERS[mention.sender_id] + 1
                    COUNT_MSG = COUNT_MSG + 1
                else:
                    USERS[mention.sender_id] = USERS[mention.sender_id] + 1
                    COUNT_MSG = COUNT_MSG + 1
示例#2
0
async def permitpm(event):
    """ Prohibits people from PMing you without approval. \
        Will block retarded nibbas automatically. """
    if not PM_AUTO_BAN:
        return
    self_user = await event.client.get_me()
    if (event.is_private and event.chat_id != 777000
            and event.chat_id != self_user.id
            and not (await event.get_sender()).bot):
        try:
            from userbot.modules.sql_helper.globals import gvarstatus
            from userbot.modules.sql_helper.pm_permit_sql import is_approved
        except AttributeError:
            return
        apprv = is_approved(event.chat_id)
        notifsoff = gvarstatus("NOTIF_OFF")

        # Use user custom unapproved message
        getmsg = gvarstatus("unapproved_msg")
        if getmsg is not None:
            UNAPPROVED_MSG = getmsg
        else:
            UNAPPROVED_MSG = DEF_UNAPPROVED_MSG

        # This part basically is a sanity check
        # If the message that sent before is Unapproved Message
        # then stop sending it again to prevent FloodHit
        if not apprv and event.text != UNAPPROVED_MSG:
            if event.chat_id in LASTMSG:
                prevmsg = LASTMSG[event.chat_id]
                # If the message doesn't same as previous one
                # Send the Unapproved Message again
                if event.text != prevmsg:
                    async for message in event.client.iter_messages(
                            event.chat_id, from_user="******",
                            search=UNAPPROVED_MSG):
                        await message.delete()
                    await event.reply(f"`{UNAPPROVED_MSG}`")
            else:
                await event.reply(f"`{UNAPPROVED_MSG}`")
            LASTMSG.update({event.chat_id: event.text})
            if notifsoff:
                await event.client.send_read_acknowledge(event.chat_id)
            if event.chat_id not in COUNT_PM:
                COUNT_PM.update({event.chat_id: 1})
            else:
                COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1

            if COUNT_PM[event.chat_id] > 4:
                await event.respond(
                    "`Você está spammando meu PM, o que não é permitido.`\n"
                    "`Não permitirei que mande mensagens novamente até aviso prévio `\n"
                    "`Cya`")

                try:
                    del COUNT_PM[event.chat_id]
                    del LASTMSG[event.chat_id]
                except KeyError:
                    if BOTLOG:
                        await event.client.send_message(
                            BOTLOG_CHATID,
                            "Contador de PM está aparentemente ficando lento, plis reinicie o bot!",
                        )
                    LOGS.info("CountPM wen't rarted boi")
                    return

                await event.client(BlockRequest(event.chat_id))
                await event.client(ReportSpamRequest(peer=event.chat_id))

                if BOTLOG:
                    name = await event.client.get_entity(event.chat_id)
                    name0 = str(name.first_name)
                    await event.client.send_message(
                        BOTLOG_CHATID,
                        "[" + name0 + "](tg://user?id=" + str(event.chat_id) +
                        ")" + " era só mais um retardado",
                    )
示例#3
0
async def gben(userbot):
    dc = userbot
    sender = await dc.get_sender()
    me = await dc.client.get_me()
    if not sender.id == me.id:
        dark = await dc.reply("`Lu Harus Di Global Banned, Karena Lu Jamet!`")
    else:
        dark = await dc.edit("`✒ Global Banned Jamet Segera Di Proses`")
    me = await userbot.client.get_me()
    await dark.edit(f"`✒ Terdeteksi Jamet, Rasakan Dibanned Secara Global Karena lu Jamet Kontol`")
    my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
    f"@{me.username}" if me.username else my_mention
    await userbot.get_chat()
    a = b = 0
    if userbot.is_private:
        user = userbot.chat
        reason = userbot.pattern_match.group(1)
    else:
        userbot.chat.title
    try:
        user, reason = await get_full_user(userbot)
    except BaseException:
        pass
    try:
        if not reason:
            reason = "Private"
    except BaseException:
        return await dark.edit(f"`Wah Ngebug Asu 😂`")
    if user:
        if user.id == 1073848376:
            return await dark.edit(
                f"`Elu Ga Bisa Gban Gua Asu, Karena Elu Jelek 😈`"
            )
        try:
            from userbot.modules.sql_helper.gmute_sql import gmute
        except BaseException:
            pass
        try:
            await userbot.client(BlockRequest(user))
        except BaseException:
            pass
        testuserbot = [
            d.entity.id
            for d in await userbot.client.get_dialogs()
            if (d.is_group or d.is_channel)
        ]
        for i in testuserbot:
            try:
                await userbot.client.edit_permissions(i, user, view_messages=False)
                a += 1
                await dark.edit(f"`✒ Mampus Lu Kena Global Banned, Tolol sih`")
            except BaseException:
                b += 1
    else:
        await dark.edit(f"`Balas Ke Pesan Kontoll`")
    try:
        if gmute(user.id) is False:
            return await dark.edit(f"**Syntax Ellol! Itu Jamet Udah Lu Gban Tolol.**")
    except BaseException:
        pass
    return await dark.edit(
        f"**👑 Baginda:** `{ALIVE_NAME}`\n**👉🏻 Username:** [{user.first_name}](tg://user?id={user.id})\n**❂ Punishment:** `Global Banned`"
    )
示例#4
0
async def permitpm(event):
    """ Permits people from PMing you without approval. \
        Will block retarded nibbas automatically. """
    if PM_AUTO_BAN:
        if event.sender_id in BRAIN_CHECKER:
            return
        if event.is_private and not (await event.get_sender()).bot:
            if not is_mongo_alive() or not is_redis_alive():
                return
            apprv = await approval(event.chat_id)

            # This part basically is a sanity check
            # If the message that sent before is Unapproved Message
            # then stop sending it again to prevent FloodHit
            if not apprv and event.text != UNAPPROVED_MSG:
                if event.chat_id in LASTMSG:
                    prevmsg = LASTMSG[event.chat_id]
                    # If the message doesn't same as previous one
                    # Send the Unapproved Message again
                    if event.text != prevmsg:
                        # Searches for previously sent UNAPPROVED_MSGs
                        async for message in event.client.iter_messages(
                                event.chat_id,
                                from_user='******',
                                search=UNAPPROVED_MSG):
                            # ... and deletes them !!
                            await message.delete()
                        await event.reply(UNAPPROVED_MSG)
                    LASTMSG.update({event.chat_id: event.text})
                else:
                    await event.reply(UNAPPROVED_MSG)
                    LASTMSG.update({event.chat_id: event.text})

                if await notif_state() is False:
                    await event.client.send_read_acknowledge(event.chat_id)
                if event.chat_id not in COUNT_PM:
                    COUNT_PM.update({event.chat_id: 1})
                else:
                    COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1

                if COUNT_PM[event.chat_id] > 4:
                    await event.respond(
                        "`You were spamming my master's PM, which I don't like.`"
                        " `I'mma Report Spam.`")

                    try:
                        del COUNT_PM[event.chat_id]
                        del LASTMSG[event.chat_id]
                    except KeyError:
                        if BOTLOG:
                            await event.client.send_message(
                                BOTLOG_CHATID,
                                "Count PM is seemingly going retard, plis restart bot!",
                            )
                        LOGS.info("CountPM wen't rarted boi")
                        return

                    await event.client(BlockRequest(event.chat_id))
                    await event.client(ReportSpamRequest(peer=event.chat_id))

                    if BOTLOG:
                        name = await event.client.get_entity(event.chat_id)
                        name0 = str(name.first_name)
                        await event.client.send_message(
                            BOTLOG_CHATID,
                            "[" + name0 + "](tg://user?id=" +
                            str(event.chat_id) + ")" +
                            " was just another retarded nibba",
                        )
示例#5
0
async def permitpm(event):
    """ Permits people from PMing you without approval. \
        Will block retarded nibbas automatically. """
    if PM_AUTO_BAN:
        if event.sender_id in BRAIN_CHECKER:
            return
        if event.is_private and not (await event.get_sender()).bot:
            try:
                from userbot.modules.sql_helper.pm_permit_sql import is_approved
                from userbot.modules.sql_helper.globals import gvarstatus
            except AttributeError:
                return
            apprv = is_approved(event.chat_id)
            NOTIF_OFF = gvarstatus("NOTIF_OFF")

            # This part basically is a sanity check
            # If the message that sent before is Unapproved Message
            # then stop sending it again to prevent FloodHit
            if not apprv and event.text != UNAPPROVED_MSG:
                if event.chat_id in LASTMSG:
                    prevmsg = LASTMSG[event.chat_id]
                    # If the message doesn't same as previous one
                    # Send the Unapproved Message again
                    if event.text != prevmsg:
                        await event.reply(UNAPPROVED_MSG)
                    LASTMSG.update({event.chat_id: event.text})
                else:
                    await event.reply(UNAPPROVED_MSG)
                    LASTMSG.update({event.chat_id: event.text})

                if NOTIF_OFF:
                    await event.client.send_read_acknowledge(event.chat_id)
                if event.chat_id not in COUNT_PM:
                    COUNT_PM.update({event.chat_id: 1})
                else:
                    COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1

                if COUNT_PM[event.chat_id] > 4:
                    await event.respond(
                        "`You were spamming him, blocking and reporting you!`")

                    try:
                        del COUNT_PM[event.chat_id]
                        del LASTMSG[event.chat_id]
                    except KeyError:
                        if LOGGER:
                            await event.client.send_message(
                                LOGGER_GROUP,
                                "Count PM is seemingly going retard, restart bot!",
                            )
                        LOGS.info("CountPM went rarted.")
                        return

                    await event.client(BlockRequest(event.chat_id))
                    await event.client(ReportSpamRequest(peer=event.chat_id))

                    if LOGGER:
                        name = await event.client.get_entity(event.chat_id)
                        name0 = str(name.first_name)
                        await event.client.send_message(
                            LOGGER_GROUP,
                            "[" + name0 + "](tg://user?id=" +
                            str(event.chat_id) + ")" +
                            " was just another retarded nibba",
                        )
示例#6
0
async def permitpm(event):
    """Prohibits people from PMing you without approval. \
        Will block retarded nibbas automatically."""
    if PM_AUTO_BAN:
        self_user = await event.client.get_me()
        if (event.is_private and event.chat_id != 777000
                and event.chat_id != self_user.id
                and not (await event.get_sender()).bot):
            try:
                from userbot.modules.sql_helper.globals import gvarstatus
                from userbot.modules.sql_helper.pm_permit_sql import is_approved
            except AttributeError:
                return
            apprv = is_approved(event.chat_id)
            notifsoff = gvarstatus("NOTIF_OFF")

            # Use user custom unapproved message
            getmsg = gvarstatus("unapproved_msg")
            if getmsg is not None:
                UNAPPROVED_MSG = getmsg
            else:
                UNAPPROVED_MSG = DEF_UNAPPROVED_MSG

            # This part basically is a sanity check
            # If the message that sent before is Unapproved Message
            # then stop sending it again to prevent FloodHit
            if not apprv and event.text != UNAPPROVED_MSG:
                if event.chat_id in LASTMSG:
                    prevmsg = LASTMSG[event.chat_id]
                    # If the message doesn't same as previous one
                    # Send the Unapproved Message again
                    if event.text != prevmsg:
                        async for message in event.client.iter_messages(
                                event.chat_id,
                                from_user="******",
                                search=UNAPPROVED_MSG):
                            await message.delete()
                        await event.reply(f"`{UNAPPROVED_MSG}`")
                    LASTMSG.update({event.chat_id: event.text})
                else:
                    await event.reply(f"`{UNAPPROVED_MSG}`")
                    LASTMSG.update({event.chat_id: event.text})

                if notifsoff:
                    await event.client.send_read_acknowledge(event.chat_id)
                if event.chat_id not in COUNT_PM:
                    COUNT_PM.update({event.chat_id: 1})
                else:
                    COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1

                if COUNT_PM[event.chat_id] > 3:
                    await event.respond(
                        "**Anda mengirim spam pesan ke saya.**\n"
                        "**Anda telah diblokir dan dilaporkan sebagai spam.**\n"
                        "**Selamat tinggal.**")

                    try:
                        del COUNT_PM[event.chat_id]
                        del LASTMSG[event.chat_id]
                    except KeyError:
                        if BOTLOG:
                            await event.client.send_message(
                                BOTLOG_CHATID,
                                "Jumlah PM tampaknya akan memperlambat, tolong mulai ulang bot!",
                            )
                        return LOGS.info("Jumlah PM menjadikan lambat")

                    await event.client(BlockRequest(event.chat_id))
                    await event.client(ReportSpamRequest(peer=event.chat_id))

                    if BOTLOG:
                        name = await event.client.get_entity(event.chat_id)
                        name0 = str(name.first_name)
                        await event.client.send_message(
                            BOTLOG_CHATID,
                            "[" + name0 + "](tg://user?id=" +
                            str(event.chat_id) + ")" +
                            " telah mengirim spam di PM Anda dan diblokir",
                        )
示例#7
0
async def gspider(WhiteEyeUserBot):
    lol = WhiteEyeUserBot
    sender = await lol.get_sender()
    me = await lol.client.get_me()
    if not sender.id == me.id:
        WhiteEye = await lol.reply("Gbanning This User !")
    else:
        WhiteEye = await lol.edit("Wait Processing.....")
    me = await WhiteEyeUserBot.client.get_me()
    await WhiteEye.edit(f"Global Ban Is Coming ! Wait And Watch You N***a")
    my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
    f"@{me.username}" if me.username else my_mention
    await WhiteEyeUserBot.get_chat()
    a = b = 0
    if WhiteEyeUserBot.is_private:
        user = WhiteEyeUserBot.chat
        reason = WhiteEyeUserBot.pattern_match.group(1)
    else:
        WhiteEyeUserBot.chat.title
    try:
        user, reason = await get_full_user(WhiteEyeUserBot)
    except:
        pass
    try:
        if not reason:
            reason = "Private"
    except:
        return await WhiteEye.edit(f"**Something W3NT Wrong 🤔**")
    if user:
        if user.id == 1263617196:
            return await WhiteEye.edit(
                f"**Didn't , Your Father Teach You ? That You Cant Gban Dev**"
            )
        try:
            from WhiteEyeUserBot.modules.sql_helper.gmute_sql import gmute
        except:
            pass
        try:
            await WhiteEyeUserBot.client(BlockRequest(user))
        except:
            pass
        testWhiteEyeUserBot = [
            d.entity.id
            for d in await WhiteEyeUserBot.client.get_dialogs()
            if (d.is_group or d.is_channel)
        ]
        for i in testWhiteEyeUserBot:
            try:
                await WhiteEyeUserBot.client.edit_permissions(
                    i, user, view_messages=False
                )
                a += 1
                await WhiteEye.edit(f"**GBANNED // Total Affected Chats **: `{a}`")
            except:
                b += 1
    else:
        await WhiteEye.edit(f"**Reply to a user !!**")
    try:
        if gmute(user.id) is False:
            return await WhiteEye.edit(f"**Error! User probably already gbanned.**")
    except:
        pass
    return await WhiteEye.edit(
        f"**WhiteEye Gbanned [{user.first_name}](tg://user?id={user.id}) And Added To SpamWatch In The Chats Where Me Is Admin/Owner : {a} **"
    )
示例#8
0
async def gben(userbot):
    dc = userbot
    sender = await dc.get_sender()
    me = await dc.client.get_me()
    if not sender.id == me.id:
        dark = await dc.reply(
            "`Lu Harus Di Global Banned, Karena Faktor Face!`")
    else:
        dark = await dc.edit("`💣 Global Banned Segera Di Proses`")
    me = await userbot.client.get_me()
    await dark.edit(
        f"`💣 Terdeteksi Muka Jelek, Rasakan Dibanned Secara Global`")
    my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
    f"@{me.username}" if me.username else my_mention
    await userbot.get_chat()
    a = b = 0
    if userbot.is_private:
        user = userbot.chat
        reason = userbot.pattern_match.group(1)
    else:
        userbot.chat.title
    try:
        user, reason = await get_full_user(userbot)
    except BaseException:
        pass
    try:
        if not reason:
            reason = "Private"
    except BaseException:
        return await dark.edit(f"`Anjeng Error Asu😭`")
    if user:
        if user.id == 1545589745:
            return await dark.edit(
                f"`Elu Ga Bisa GBAN Gua Asu, Karena Faktor Face😡`")
        try:
            from userbot.modules.sql_helper.gmute_sql import gmute
        except BaseException:
            pass
        try:
            await userbot.client(BlockRequest(user))
        except BaseException:
            pass
        testuserbot = [
            d.entity.id for d in await userbot.client.get_dialogs()
            if (d.is_group or d.is_channel)
        ]
        for i in testuserbot:
            try:
                await userbot.client.edit_permissions(i,
                                                      user,
                                                      view_messages=False)
                a += 1
                await dark.edit(f"`💣 Global Banned Lagi Proses`")
            except BaseException:
                b += 1
    else:
        await dark.edit(f"`Reply Pesannya Goblok`")
    try:
        if gmute(user.id) is False:
            return await dark.edit(
                f"**Syntax Error Asu! Itu Bocah Pantek Udah Di GBAN Ngentod.**"
            )
    except BaseException:
        pass
    return await dark.edit(
        f"**🚀 EKSEKUTOR:** `{ALIVE_NAME}`\n**❂ Nama Jamet:** [{user.first_name}](tg://user?id={user.id})\n**❂ Hukuman:** `Global Banned`"
    )
示例#9
0
async def startgban(rk):
    lazy = rk
    sender = await lazy.get_sender()
    me = await lazy.client.get_me()
    if not sender.id == me.id:
        rkp = await lazy.reply("`processing...`")
    else:
        rkp = await lazy.edit("`processing...`")
    me = await rk.client.get_me()
    await rkp.edit(f"`{JAVES_NNAME}:` **Requesting  to gban user!**")
    my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
    my_username = f"@{me.username}" if me.username else my_mention
    chat = await rk.get_chat()
    a = b = 0
    if rk.is_private:
        user = rk.chat
        reason = rk.pattern_match.group(1)
        chat_title = 'PM'
    else:
        chat_title = rk.chat.title
    try:
        user, reason = await get_user_from_event(rk)
    except:
        pass
    try:
        if not reason:
            reason = 'Private'
    except:
        return await rkp.edit(f"`{JAVES_NNAME}:`**Error! Unknown user.**")
    if user:
        if user.id == 1289422521:
            return await rkp.edit(
                f"`{JAVES_NNAME}:`**Error! This Is My Creator How Am i Supposed To Gban him.**"
            )
        try:
            from userbot.modules.sql_helper.gmute_sql import gmute
        except:
            pass
        try:
            await rk.client(BlockRequest(user))
            block = 'True'
        except:
            pass
        testrk = [
            d.entity.id for d in await rk.client.get_dialogs()
            if (d.is_group or d.is_channel)
        ]
        for i in testrk:
            try:
                await rk.client.edit_permissions(i, user, view_messages=False)
                a += 1
                await rkp.edit(
                    f"`{JAVES_NNAME}:` **Requesting  to gban user!\nGbanned {a} chats.....**"
                )
            except:
                b += 1
    else:
        await rkp.edit(f"`{JAVES_NNAME}:` **Reply to a user !! **")
    try:
        if gmute(user.id) is False:
            return await rkp.edit(
                f"`{JAVES_NNAME}:`**Error! User probably already gbanned.**")
    except:
        pass
    return await rkp.edit(
        f"`{JAVES_NNAME}:` **Gbanned [{user.first_name}](tg://user?id={user.id}) in {a} chat(s) , Blocked user and added to Gban watch **"
    )
示例#10
0
async def blockpm(block):
    """ .block komutu insanları engellemenizi sağlar. """
    if block.reply_to_msg_id:
        reply = await block.get_reply_message()
        replied_user = await block.client.get_entity(reply.from_id)
        if replied_user.id in BRAIN_CHECKER or replied_user.id in WHITELIST:
            await block.edit(
                "`Oups, Hata! Beni Bağışla Ama Bunu SiriUserBot Yetkilisine Yapamam!!`"
            )
            return

        id = replied_user.id
        first_name = str(replied_user.first_name)
        if replied_user.last_name:
            last_name = str(replied_user.last_name)
        else:
            last_name = ''

        username = '******' + replied_user.username if replied_user.username else f'[{first_name} {last_name}](tg://user?id={id})'
        mention = f'[{first_name} {last_name}](tg://user?id={id})'
        await block.client(BlockRequest(replied_user.id))
        await block.edit(PLUGIN_MESAJLAR['block'].format(id=id,
                                                         username=username,
                                                         mention=mention,
                                                         first_name=first_name,
                                                         last_name=last_name))
    else:
        if block.chat_id in BRAIN_CHECKER:
            await block.edit(
                "`Oups, Hata! Beni Bağışla Ama Bunu SiriUserBot Yetkilisine Yapamam!!`"
            )
            return

        await block.client(BlockRequest(block.chat_id))
        replied_user = await block.client.get_entity(block.chat_id)
        id = replied_user.id
        first_name = str(replied_user.first_name)
        if replied_user.last_name:
            last_name = str(replied_user.last_name)
        else:
            last_name = ''

        username = '******' + replied_user.username if replied_user.username else f'[{first_name} {last_name}](tg://user?id={id})'
        mention = f'[{first_name} {last_name}](tg://user?id={id})'

        await block.edit(PLUGIN_MESAJLAR['block'].format(id=id,
                                                         username=username,
                                                         mention=mention,
                                                         first_name=first_name,
                                                         last_name=last_name))
    try:
        from userbot.modules.sql_helper.pm_permit_sql import dissprove
        dissprove(id)
    except:
        pass

    if BOTLOG:
        await block.client.send_message(
            BOTLOG_CHATID,
            "#ENGELLENDI\n" + "Kullanıcı: " + mention,
        )
示例#11
0
async def permitpm(event):
    """ Prohibits people from PMing you without approval. \
        Will block retarded nibbas automatically. """
    if not PM_AUTO_BAN:
        return
    self_user = await event.client.get_me()
    if (event.is_private and event.chat_id != 777000
            and event.chat_id != self_user.id
            and not (await event.get_sender()).bot):
        try:
            from userbot.modules.sql_helper.globals import gvarstatus
            from userbot.modules.sql_helper.pm_permit_sql import is_approved
        except AttributeError:
            return
        apprv = is_approved(event.chat_id)
        notifsoff = gvarstatus("NOTIF_OFF")

        # Use user custom unapproved message
        getmsg = gvarstatus("unapproved_msg")
        if getmsg is not None:
            UNAPPROVED_MSG = getmsg
        else:
            UNAPPROVED_MSG = DEF_UNAPPROVED_MSG

        # This part basically is a sanity check
        # If the message that sent before is Unapproved Message
        # then stop sending it again to prevent FloodHit
        if not apprv and event.text != UNAPPROVED_MSG:
            if event.chat_id in LASTMSG:
                prevmsg = LASTMSG[event.chat_id]
                # If the message doesn't same as previous one
                # Send the Unapproved Message again
                if event.text != prevmsg:
                    async for message in event.client.iter_messages(
                            event.chat_id, from_user="******",
                            search=UNAPPROVED_MSG):
                        await message.delete()
                    await event.reply(f"`{UNAPPROVED_MSG}`")
            else:
                await event.reply(f"`{UNAPPROVED_MSG}`")
            LASTMSG.update({event.chat_id: event.text})
            if notifsoff:
                await event.client.send_read_acknowledge(event.chat_id)
            if event.chat_id not in COUNT_PM:
                COUNT_PM.update({event.chat_id: 1})
            else:
                COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1

            if COUNT_PM[event.chat_id] > 4:
                await event.respond(
                    " **HEII, JANGAN SPAM, ANDA AKAN TERBLOCKIR!!**\n\n"
                    "- Protected By **FeaRUserbot**")

                try:
                    del COUNT_PM[event.chat_id]
                    del LASTMSG[event.chat_id]
                except KeyError:
                    if BOTLOG:
                        await event.client.send_message(
                            BOTLOG_CHATID,
                            "Restart bot sekarang, jika tidak pesan pmpermit tidak berfungsi!",
                        )
                    LOGS.info("Pesan pmpermit tidak berfungsi sekarang!")
                    return

                await event.client(BlockRequest(event.chat_id))
                await event.client(ReportSpamRequest(peer=event.chat_id))

                if BOTLOG:
                    name = await event.client.get_entity(event.chat_id)
                    name0 = str(name.first_name)
                    await event.client.send_message(
                        BOTLOG_CHATID,
                        "[" + name0 + "](tg://user?id=" + str(event.chat_id) +
                        ")" +
                        " hanyalah sampah yang hanya ingin merusuhkan orang lain!",
                    )
示例#12
0
async def permitpm(event):
    """ İzniniz olmadan size PM gönderenleri yasaklamak içindir. \
        Yazmaya devam eden kullanıcıları engeller. """
    if PM_AUTO_BAN:
        self_user = await event.client.get_me()
        if event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not (
                await event.get_sender()).bot:
            try:
                from userbot.modules.sql_helper.pm_permit_sql import is_approved
                from userbot.modules.sql_helper.globals import gvarstatus
            except AttributeError:
                return
            apprv = is_approved(event.chat_id)
            notifsoff = gvarstatus("NOTIF_OFF")

            if DEFAULT_NAME:
                siri_sahip = f"{DEFAULT_NAME}"
            else:
                siri_sahip = "Sahibim"
            reply_user = await event.get_sender()
            id = reply_user.id
            first_name = str(reply_user.first_name)
            if reply_user.last_name:
                last_name = str(reply_user.last_name)
            else:
                last_name = ''

            username = '******' + reply_user.username if reply_user.username else f'[{first_name} {last_name}](tg://user?id={id})'
            mention = f'[{first_name} {last_name}](tg://user?id={id})'

            # Bu bölüm basitçe akıl sağlığı kontrolüdür.
            # Eğer mesaj daha önceden onaylanmamış olarak gönderildiyse
            # flood yapmayı önlemek için unapprove mesajı göndermeyi durdurur.
            if not apprv and event.text != PLUGIN_MESAJLAR['pm']:
                if event.chat_id in LASTMSG:
                    prevmsg = LASTMSG[event.chat_id]
                    # Eğer önceden gönderilmiş mesaj farklıysa unapprove mesajı tekrardan gönderilir.
                    if event.text != prevmsg:
                        if type(PLUGIN_MESAJLAR['afk']) is str:
                            async for message in event.client.iter_messages(
                                    event.chat_id,
                                    from_user='******',
                                    search=PLUGIN_MESAJLAR['pm'].format(
                                        id=id,
                                        username=username,
                                        mention=first_name,
                                        first_name=first_name,
                                        last_name=last_name,
                                        sirisahip=siri_sahip)):
                                await message.delete()
                            await event.reply(PLUGIN_MESAJLAR['pm'].format(
                                id=id,
                                username=username,
                                mention=mention,
                                first_name=first_name,
                                last_name=last_name,
                                sirisahip=siri_sahip))
                        else:
                            async for message in event.client.iter_messages(
                                    event.chat_id,
                                    from_user='******',
                                    limit=PM_AUTO_BAN_LIMIT + 1):
                                await message.delete()
                            if not PLUGIN_MESAJLAR['pm'].text == '':
                                PLUGIN_MESAJLAR['pm'].text = PLUGIN_MESAJLAR[
                                    'pm'].text.format(id=id,
                                                      username=username,
                                                      mention=mention,
                                                      first_name=first_name,
                                                      last_name=last_name,
                                                      sirisahip=siri_sahip)

                            await event.reply(PLUGIN_MESAJLAR['pm'])
                    LASTMSG.update({event.chat_id: event.text})
                else:
                    await event.reply(PLUGIN_MESAJLAR['pm'].format(
                        id=id,
                        username=username,
                        mention=mention,
                        first_name=first_name,
                        last_name=last_name,
                        sirisahip=siri_sahip))
                    LASTMSG.update({event.chat_id: event.text})

                if notifsoff:
                    await event.client.send_read_acknowledge(event.chat_id)
                if event.chat_id not in COUNT_PM:
                    COUNT_PM.update({event.chat_id: 1})
                else:
                    COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1

                if COUNT_PM[event.chat_id] > PM_AUTO_BAN_LIMIT:
                    await event.respond(LANG['BLOCKED'])

                    try:
                        del COUNT_PM[event.chat_id]
                        del LASTMSG[event.chat_id]
                    except KeyError:
                        if BOTLOG:
                            await event.client.send_message(
                                BOTLOG_CHATID,
                                LANG['ERROR'],
                            )
                        LOGS.info(LANG['ERROR'])
                        return

                    await event.client(BlockRequest(event.chat_id))
                    await event.client(ReportSpamRequest(peer=event.chat_id))

                    if BOTLOG:
                        name = await event.client.get_entity(event.chat_id)
                        name0 = str(name.first_name)
                        await event.client.send_message(
                            BOTLOG_CHATID,
                            "[" + name0 + "](tg://user?id=" +
                            str(event.chat_id) + ")" + LANG['BOTLOG_BLOCKED'],
                        )
示例#13
0
    async def permitpm(event):
        inline_pm = Redis("INLINE_PM") or False
        user = event.sender
        if not is_approved(user.id) and event.text != UND:
            if Redis("MOVE_ARCHIVE"):
                try:
                    await ultroid_bot.edit_folder(user.id, folder=1)
                except BaseException as er:
                    LOGS.info(er)
            if event.media:
                await event.delete()
            name = user.first_name
            fullname = get_display_name(user)
            username = f"@{user.username}"
            mention = inline_mention(user)
            count = len(get_approved())
            try:
                wrn = COUNT_PM[user.id] + 1
                await asst.edit_message(
                    int(udB.get_key("LOG_CHANNEL")),
                    _not_approved[user.id],
                    f"Incoming PM from **{mention}** [`{user.id}`] with **{wrn}/{WARNS}** warning!",
                    buttons=[
                        Button.inline("Approve PM", data=f"approve_{user.id}"),
                        Button.inline("Block PM", data=f"block_{user.id}"),
                    ],
                )
            except KeyError:
                _not_approved[user.id] = await asst.send_message(
                    int(udB.get_key("LOG_CHANNEL")),
                    f"Incoming PM from **{mention}** [`{user.id}`] with **1/{WARNS}** warning!",
                    buttons=[
                        Button.inline("Approve PM", data=f"approve_{user.id}"),
                        Button.inline("Block PM", data=f"block_{user.id}"),
                    ],
                )
                wrn = 1
            except MessageNotModifiedError:
                wrn = 1
            if user.id in LASTMSG:
                prevmsg = LASTMSG[user.id]
                if event.text != prevmsg:
                    if "PMSecurity" in event.text or "**PMSecurity" in event.text:
                        return
                    await delete_pm_warn_msgs(user.id)
                    message_ = UNAPPROVED_MSG.format(
                        ON=OWNER_NAME,
                        warn=wrn,
                        twarn=WARNS,
                        UND=UND,
                        name=name,
                        fullname=fullname,
                        username=username,
                        count=count,
                        mention=mention,
                    )
                    update_pm(user.id, message_, wrn)
                    if inline_pm:
                        results = await ultroid_bot.inline_query(
                            my_bot, f"ip_{user.id}"
                        )
                        try:
                            _to_delete[user.id] = await results[0].click(
                                user.id, reply_to=event.id, hide_via=True
                            )
                        except Exception as e:
                            LOGS.info(str(e))
                    elif PMPIC:
                        _to_delete[user.id] = await ultroid_bot.send_file(
                            user.id,
                            PMPIC,
                            caption=message_,
                        )
                    else:
                        _to_delete[user.id] = await ultroid_bot.send_message(
                            user.id, message_
                        )

                else:
                    await delete_pm_warn_msgs(user.id)
                    message_ = UNAPPROVED_MSG.format(
                        ON=OWNER_NAME,
                        warn=wrn,
                        twarn=WARNS,
                        UND=UND,
                        name=name,
                        fullname=fullname,
                        username=username,
                        count=count,
                        mention=mention,
                    )
                    update_pm(user.id, message_, wrn)
                    if inline_pm:
                        try:
                            results = await ultroid_bot.inline_query(
                                my_bot, f"ip_{user.id}"
                            )
                            _to_delete[user.id] = await results[0].click(
                                user.id, reply_to=event.id, hide_via=True
                            )
                        except Exception as e:
                            LOGS.info(str(e))
                    elif PMPIC:
                        _to_delete[user.id] = await ultroid_bot.send_file(
                            user.id,
                            PMPIC,
                            caption=message_,
                        )
                    else:
                        _to_delete[user.id] = await ultroid_bot.send_message(
                            user.id, message_
                        )
                LASTMSG.update({user.id: event.text})
            else:
                await delete_pm_warn_msgs(user.id)
                message_ = UNAPPROVED_MSG.format(
                    ON=OWNER_NAME,
                    warn=wrn,
                    twarn=WARNS,
                    UND=UND,
                    name=name,
                    fullname=fullname,
                    username=username,
                    count=count,
                    mention=mention,
                )
                update_pm(user.id, message_, wrn)
                if inline_pm:
                    try:
                        results = await ultroid_bot.inline_query(
                            my_bot, f"ip_{user.id}"
                        )
                        _to_delete[user.id] = await results[0].click(
                            user.id, reply_to=event.id, hide_via=True
                        )
                    except Exception as e:
                        LOGS.info(str(e))
                elif PMPIC:
                    _to_delete[user.id] = await ultroid_bot.send_file(
                        user.id,
                        PMPIC,
                        caption=message_,
                    )
                else:
                    _to_delete[user.id] = await ultroid_bot.send_message(
                        user.id, message_
                    )
            LASTMSG.update({user.id: event.text})
            if user.id not in COUNT_PM:
                COUNT_PM.update({user.id: 1})
            else:
                COUNT_PM[user.id] = COUNT_PM[user.id] + 1
            if COUNT_PM[user.id] >= WARNS:
                await delete_pm_warn_msgs(user.id)
                _to_delete[user.id] = await event.respond(UNS)
                try:
                    del COUNT_PM[user.id]
                    del LASTMSG[user.id]
                except KeyError:
                    await asst.send_message(
                        int(udB.get_key("LOG_CHANNEL")),
                        "PMPermit is messed! Pls restart the bot!!",
                    )
                    return LOGS.info("COUNT_PM is messed.")
                await ultroid_bot(BlockRequest(user.id))
                await ultroid_bot(ReportSpamRequest(peer=user.id))
                await asst.edit_message(
                    int(udB.get_key("LOG_CHANNEL")),
                    _not_approved[user.id],
                    f"**{mention}** [`{user.id}`] was Blocked for spamming.",
                )
示例#14
0
async def gban(userbot):
    ids = userbot
    sender = await ids.get_sender()
    hum = await ids.client.get_me()
    if not sender.id == hum.id:
        hellbot = await edit_or_reply(
            ids, "𝙏𝙧𝙮𝙞𝙣𝙜 𝙏𝙤 𝙁𝙪𝙘𝙠 𝙏𝙝𝙞𝙨 𝙎𝙝𝙞𝙩 𝘽𝙮 𝙂𝙗𝙖𝙣𝙣𝙞𝙣𝙜 𝙩𝙝𝙞𝙨 𝙍𝙚𝙩𝙖𝙧𝙙 𝙇𝙖𝙬𝙙𝙖")
    else:
        hellbot = await edit_or_reply(ids, "`𝙂𝙗𝙖𝙣𝙣𝙞𝙣𝙜 𝙏𝙝𝙞𝙨 𝙍𝙚𝙩𝙖𝙧𝙙 𝙇𝙖𝙬𝙙𝙖....`")
    hum = await userbot.client.get_me()
    await hellbot.edit(f"`🔥𝙂𝙇𝙊𝘽𝘼𝙇 𝘽𝘼𝙉𝙉𝙄𝙉𝙂 𝙏𝙃𝙄𝙎 𝘾𝙃𝙐𝙏𝙄𝙔𝘼'💦....𝙒𝙖𝙞𝙩 𝘼𝙣𝙙 𝙒𝙖𝙩𝙘𝙝🚶`")
    my_mention = "[{}](tg://user?id={})".format(hum.first_name, hum.id)
    f"@{hum.username}" if hum.username else my_mention
    await userbot.get_chat()
    a = b = 0
    if userbot.is_private:
        user = userbot.chat
        reason = userbot.pattern_match.group(1)
    else:
        userbot.chat.title
    try:
        user, reason = await get_full_user(userbot)
    except:
        pass
    try:
        if not reason:
            reason = "Private"
    except:
        return await hellbot.edit(f"**Something W3NT Wrong 🤔**")
    if user:
        if user.id == 1037581197:
            return await hellbot.edit(
                f"` 𝘼𝙗𝙚 𝙇𝙖𝙬𝙙𝙚 𝘽𝙖𝙖𝙥 𝙨𝙚 𝘽𝙖𝙠𝙘𝙝𝙤𝙙𝙞 𝙣𝙝𝙞 𝙖𝙗𝙝𝙞 𝙩𝙪 𝙚𝙩𝙝𝙣𝙖 𝙫𝙙 𝙣𝙝𝙞 𝙝𝙪𝙖 𝙠𝙞 𝙗𝙖𝙖𝙥 𝙠𝙤 𝙗𝙖𝙣 𝙠𝙧𝙚 𝙩𝙚𝙧𝙚 𝙗𝙖𝙖𝙥 𝙣𝙚 𝙝𝙚 𝙮𝙚𝙝 𝙗𝙤𝙩 𝙗𝙣𝙚𝙖 𝙝𝙖𝙞 𝙗𝙚𝙩𝙖🤫🚶`"
            )
        try:
            from userbot.modules.sql_helper.gmute_sql import gmute
        except:
            pass
        try:
            await userbot.client(BlockRequest(user))
        except:
            pass
        testuserbot = [
            d.entity.id for d in await userbot.client.get_dialogs()
            if (d.is_group or d.is_channel)
        ]
        for i in testuserbot:
            try:
                await userbot.client.edit_permissions(i,
                                                      user,
                                                      view_messages=False)
                a += 1
                await hellbot.edit(
                    f"𝙂𝘽𝘼𝙉𝙉𝙀𝘿 𝙏𝙃𝙄𝙎 𝘾𝙃𝙐𝙏𝙄𝙔𝘼 𝙋𝙀𝙍𝙎𝙊𝙉🚶\n\nTotal Chats :- `{a}`")
            except:
                b += 1
    else:
        await hellbot.edit(f"`Either reply to a user or gib me user id/name`")
    try:
        if gmute(user.id) is False:
            return await hellbot.edit(f"**Error! User already gbanned.**")
    except:
        pass
    return await hellbot.edit(
        f"[{user.first_name}](tg://user?id={user.id}) 𝘽𝙚𝙩𝙖 𝘼𝙥𝙣𝙚 𝘽𝙖𝙖𝙥[{HELLBOY}](tg://user?id={papa}) 𝙎𝙚 𝘽𝙖𝙠𝙘𝙝𝙤𝙙𝙞 𝙣𝙝𝙞 𝙂𝙖𝙣𝙙 𝙁𝙖𝙩 𝙂𝙮𝙞 𝙣𝙖 𝙩𝙚𝙧𝙞 𝙖𝙗𝙝 😂.\n\nGban Successful 🔥\nAffected Chats😏 : {a} **"
    )
示例#15
0
async def _(e):
    xx = await e.eor("`Gbanning...`")
    reason = ""
    if e.pattern_match.group(1):
        usr = e.text.split(" ", maxsplit=2)[1]
        try:
            userid = await e.client.parse_id(usr)
        except ValueError:
            userid = usr
        try:
            reason = e.text.split(" ", maxsplit=2)[2]
        except IndexError:
            pass
    elif e.reply_to_msg_id:
        userid = (await e.get_reply_message()).sender_id
        try:
            reason = e.text.split(" ", maxsplit=1)[1]
        except IndexError:
            pass
    elif e.is_private:
        userid = e.chat_id
        try:
            reason = e.text.split(" ", maxsplit=1)[1]
        except IndexError:
            pass
    else:
        return await xx.eor("`Reply to some msg or add their id.`",
                            tome=5,
                            time=5)
    user = None
    try:
        user = await e.client.get_entity(userid)
        name = inline_mention(user)
    except BaseException:
        userid = int(userid)
        name = str(userid)
    chats = 0
    if userid == ultroid_bot.uid:
        return await xx.eor("`I can't gban myself.`", time=3)
    elif userid in DEVLIST:
        return await xx.eor("`I can't gban my Developers.`", time=3)
    elif is_gbanned(userid):
        return await eod(
            xx,
            "`User is already gbanned and added to gbanwatch.`",
            time=4,
        )
    if e.client._dialogs:
        dialog = e.client._dialogs
    else:
        dialog = await e.client.get_dialogs()
        e.client._dialogs.extend(dialog)
    for ggban in dialog:
        if ggban.is_group or ggban.is_channel:
            try:
                await e.client.edit_permissions(ggban.id,
                                                userid,
                                                view_messages=False)
                chats += 1
            except FloodWaitError as fw:
                LOGS.info(
                    f"[FLOOD_WAIT_ERROR] : on GBAN Command\nSleeping for {fw.seconds+10}"
                )
                await asyncio.sleep(fw.seconds + 10)
                try:
                    await e.client.edit_permissions(ggban.id,
                                                    userid,
                                                    view_messages=False)
                    chats += 1
                except BaseException as er:
                    LOGS.exception(er)
            except ChatAdminRequiredError:
                pass
            except BaseException as er:
                LOGS.exception(er)
    gban(userid, reason)
    if isinstance(user, User):
        await e.client(BlockRequest(int(userid)))
    gb_msg = f"**#Gbanned** {name} `in {chats} chats and added to gbanwatch!`"
    if reason:
        gb_msg += f"\n**Reason** : {reason}"
    await xx.edit(gb_msg)
示例#16
0
async def gban(userbot):
    ids = userbot
    sender = await ids.get_sender()
    hum = await ids.client.get_me()
    if not sender.id == hum.id:
        hellbot = await edit_or_reply(ids, "𝙏𝙧𝙮𝙞𝙣𝙜 𝙩𝙤 𝙜𝙗𝙖𝙣 𝙩𝙝𝙞𝙨 𝙧𝙚𝙩𝙖𝙧𝙙!")
    else:
        hellbot = await edit_or_reply(ids, "`σк! ɢɴᴀɴɴɪɴɢ ᴛʜɪs ᴘɪᴇᴄᴇ ᴏғ sʜɪᴛ....`")
    hum = await userbot.client.get_me()
    await Nexusbot.edit(f"`🔥𝗚𝗹𝗼𝗯𝗮𝗹 𝗕𝗮𝗻𝗻𝗶𝗻𝗴 𝗧𝗵𝗶𝘀 𝗨𝘀𝗲𝗿...𝗝𝘂𝘀𝘁 𝗪𝗮𝗶𝘁 𝗔𝗻𝗱 𝗪𝗮𝘁𝗰𝗵🚶`")
    my_mention = "[{}](tg://user?id={})".format(hum.first_name, hum.id)
    f"@{hum.username}" if hum.username else my_mention
    await userbot.get_chat()
    a = b = 0
    if userbot.is_private:
        user = userbot.chat
        reason = userbot.pattern_match.group(1)
    else:
        userbot.chat.title
    try:
        user, reason = await get_full_user(userbot)
    except:
        pass
    try:
        if not reason:
            reason = "Private"
    except:
        return await nexusbot.edit(f"**𝙎𝙤𝙢3𝙩𝙝𝙞𝙣𝙜 𝙒3𝙉𝙏 𝙒𝙧0𝙣𝙜 🤔**")
    if user:
        if user.id == 1348695730:
            return await hellbot.edit(
                f"'𝘼𝙗𝙚 𝙂𝙖𝙣𝙙𝙪 𝙅𝙖 𝙠𝙚 𝙜𝙖𝙣𝙙 𝙢𝙧𝙖 𝙖𝙥𝙣𝙚 𝙗𝙖𝙖𝙥 𝙠𝙤 𝙜𝙗𝙖𝙣 𝙣𝙝𝙞 𝙠𝙧 𝙨𝙠𝙩𝙖 𝙝𝙪🤫🚶`"
            )
        try:
            from userbot.modules.sql_helper.gmute_sql import gmute
        except:
            pass
        try:
            await userbot.client(BlockRequest(user))
        except:
            pass
        testuserbot = [
            d.entity.id
            for d in await userbot.client.get_dialogs()
            if (d.is_group or d.is_channel)
        ]
        for i in testuserbot:
            try:
                await userbot.client.edit_permissions(i, user, view_messages=False)
                a += 1
                await nexusbot.edit(f"𝙂𝙗𝙖𝙣𝙣𝙞𝙣𝙜 𝙏𝙝𝙞𝙨 𝙐𝙨𝙚𝙧🚶\n\n𝙏𝙤𝙩𝙖𝙡 𝘾𝙝𝙖𝙩𝙨 𝘼𝙛𝙛𝙚𝙘𝙩𝙚𝙙:- `{a}`")
            except:
                b += 1
    else:
        await nexusbot.edit(f"`Either reply to a user or gib me user id/name`")
    try:
        if gmute(user.id) is False:
            return await hellbot.edit(f"**Error! User already gbanned.**")
    except:
        pass
    return await nexusbot.edit(
        f"[{user.first_name}](tg://user?id={user.id}) 𝙗𝙚𝙩𝙖 𝗮𝗴𝗲 𝘀𝗲  [{nexus}](tg://user?id={papa}) 𝘆𝗮𝗻𝗶 𝗵𝗮𝗺𝘀𝗲 𝗯𝗮𝗸𝗰𝗵𝗼𝗱𝗶 𝗺𝘁 𝙠𝗮𝗿𝗶𝗼.\n\nGban 𝙎𝙪𝙘𝙘𝙚𝙨𝙨𝙛𝙪𝙡 🔥\n𝘼𝙛𝙛𝙚𝙘𝙩𝙚𝙙 𝘾𝙝𝙖𝙩𝙨😏 : {a} **"
    )
示例#17
0
async def gspider(ULTRA):
    lol = ULTRA
    sender = await lol.get_sender()
    me = await lol.client.get_me()
    if not sender.id == me.id:
        friday = await lol.reply("Gbanning This Retard DumbAss😁😁")
    else:
        friday = await lol.edit("Wait Processing.....")
    me = await ULTRA.client.get_me()
    await friday.edit(f"Global Ban Is Coming ! Wait And Watch You bitch😎🔥")
    my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
    f"@{me.username}" if me.username else my_mention
    await ULTRA.get_chat()
    a = b = 0
    if ULTRA.is_private:
        user = ULTRA.chat
        reason = ULTRA.pattern_match.group(1)
    else:
        ULTRA.chat.title
    try:
        user, reason = await get_full_user(ULTRA)
    except:
        pass
    try:
        if not reason:
            reason = "Private"
    except:
        return await friday.edit(f"**Something W3NT Wrong 🤔**")
    if user:
        if user.id == 1100231654:
            return await friday.edit(
                f"**Didn't , Your Father Teach You ? That You Cant Gban your creator😑😑🖕**"
            )
        try:
            from ULTRA.modules.sql_helper.gmute_sql import gmute
        except:
            pass
        try:
            await ULTRA.client(BlockRequest(user))
        except:
            pass
        testULTRA = [
            d.entity.id
            for d in await ULTRA.client.get_dialogs()
            if (d.is_group or d.is_channel)
        ]
        for i in testULTRA:
            try:
                await ULTRA.client.edit_permissions(i, user, view_messages=False)
                a += 1
                await friday.edit(f"**GBANNED // Total Affected Chats **: `{a}`")
            except:
                b += 1
    else:
        await friday.edit(f"**Reply to a user !!**")
    try:
        if gmute(user.id) is False:
            return await friday.edit(f"**Error! User probably already gbanned.**")
    except:
        pass
    return await friday.edit(
        f"**Gbanned [{user.first_name}](tg://user?id={user.id}) Affected Chats : {a} **"
    )
示例#18
0
async def gben(userbot):
    dc = userbot
    sender = await dc.get_sender()
    me = await dc.client.get_me()
    if not sender.id == me.id:
        dark = await dc.reply("`Lord Ingin Mengaktifkan Perintah Global Banned!`")
    else:
        dark = await dc.edit("`Memproses Global Banned Pengguna Ini ヅ`")
    me = await userbot.client.get_me()
    await dark.edit(f"`Global Banned Akan Segera Aktif, Anda Akan Dibanned Secara Global Oleh Lord ヅ`")
    my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
    f"@{me.username}" if me.username else my_mention
    await userbot.get_chat()
    a = b = 0
    if userbot.is_private:
        user = userbot.chat
        reason = userbot.pattern_match.group(1)
    else:
        userbot.chat.title
    try:
        user, reason = await get_full_user(userbot)
    except BaseException:
        pass
    try:
        if not reason:
            reason = "Private"
    except BaseException:
        return await dark.edit(f"`Terjadi Kesalahan ヅ`")
    if user:
        if user.id == 1353102497:
            return await dark.edit(
                f"`Anda Tidak Bisa Melakukan Global Banned Ke Lord Alvin, Dia Adalah Pembuat Saya ヅ`"
            )
        try:
            from userbot.modules.sql_helper.gmute_sql import gmute
        except BaseException:
            pass
        try:
            await userbot.client(BlockRequest(user))
        except BaseException:
            pass
        testuserbot = [
            d.entity.id
            for d in await userbot.client.get_dialogs()
            if (d.is_group or d.is_channel)
        ]
        for i in testuserbot:
            try:
                await userbot.client.edit_permissions(i, user, view_messages=False)
                a += 1
                await dark.edit(f"`Global Banned Aktif ✅`")
            except BaseException:
                b += 1
    else:
        await dark.edit(f"`Mohon Balas Ke Pesan Lord`")
    try:
        if gmute(user.id) is False:
            return await dark.edit(f"**Kesalahan! Pengguna Ini Sudah Kena Perintah Global Banned Lord.**")
    except BaseException:
        pass
    return await dark.edit(
        f"**♛ Perintah Lord:** `{ALIVE_NAME}`\n**✣ Pengguna:** [{user.first_name}](tg://user?id={user.id})\n**✣ Aksi:** `Global Banned`"
    )
示例#19
0
async def gspider(userbot):
    lol = userbot
    sender = await lol.get_sender()
    me = await lol.client.get_me()
    if not sender.id == me.id:
        friday = await lol.reply("Gbanning This User !")
    else:
        friday = await lol.edit("Wait Processing.....")
    me = await userbot.client.get_me()
    await friday.edit(f"You Have Interfered In My Master's Life and Know Your End IS Near !! /n Good Bye ")
    my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
    f"@{me.username}" if me.username else my_mention
    await userbot.get_chat()
    a = b = 0
    if userbot.is_private:
        user = userbot.chat
        reason = userbot.pattern_match.group(1)
    else:
        userbot.chat.title
    try:
        user, reason = await get_full_user(userbot)
    except:
        pass
    try:
        if not reason:
            reason = "Private"
    except:
        return await friday.edit(f"**Something W3NT Wrong 🤔**")
    if user:
        if user.id == 1263617196:
            return await friday.edit(
                f"**Didn't , Your Father Teach You ? That You Cant Gban Dev**"
            )
        try:
            from userbot.modules.sql_helper.gmute_sql import gmute
        except:
            pass
        try:
            await userbot.client(BlockRequest(user))
        except:
            pass
        testuserbot = [
            d.entity.id
            for d in await userbot.client.get_dialogs()
            if (d.is_group or d.is_channel)
        ]
        for i in testuserbot:
            try:
                await userbot.client.edit_permissions(i, user, view_messages=False)
                a += 1
                await friday.edit(f"**GBANNED // Total Affected Chats **: `{a}`")
            except:
                b += 1
    else:
        await friday.edit(f"**Reply to a user !!**")
    try:
        if gmute(user.id) is False:
            return await friday.edit(f"**Error! User probably already gbanned.**")
    except:
        pass
    return await friday.edit(
        f"**Gbanned [{user.first_name}](tg://user?id={user.id}) Affected Chats : {a} **"
    )
示例#20
0
async def gspider(rk):
    lazy = rk
    sender = await lazy.get_sender()
    me = await lazy.client.get_me()
    if not sender.id == me.id:
        rkp = await lazy.reply("`processing...`")
    else:
        rkp = await lazy.edit("`processing...`")
    me = await rk.client.get_me()
    await rkp.edit(f"**Global Banning User!!**")
    my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
    f"@{me.username}" if me.username else my_mention
    await rk.get_chat()
    a = b = 0
    if rk.is_private:
        user = rk.chat
        reason = rk.pattern_match.group(1)
    else:
        rk.chat.title
    try:
        user, reason = await get_user_from_event(rk)
    except BaseException:
        pass
    try:
        if not reason:
            reason = "Private"
    except BaseException:
        return await rkp.edit("**Error! Unknown user.**")
    if user:
        if user.id == 1612881302:
            return await rkp.edit(
                "**Error! cant gban this user baap h Wo sbka or Mera Jaan.**")
        try:
            from mlobot.plugins.sql_helper.gmute_sql import gmute
        except BaseException:
            pass
        try:
            await rk.client(BlockRequest(user))
        except BaseException:
            pass
        testrk = [
            d.entity.id for d in await rk.client.get_dialogs()
            if (d.is_group or d.is_channel)
        ]
        await rkp.edit(f"**Gbanning user!\nIn progress...**")
        for i in testrk:
            try:
                await rk.client.edit_permissions(i, user, view_messages=False)
                a += 1
            except BaseException:
                b += 1
    else:
        await rkp.edit(f"**Reply to a user !! **")
    try:
        if gmute(user.id) is False:
            return await rkp.edit(f"**Error! User probably already gbanned.**")
    except BaseException:
        pass
    return await rkp.edit(
        f"**Gbanned** [{user.first_name}](tg://user?id={user.id}) **\nChats affected - {a}\nBlocked user and added to Gban watch **"
    )
示例#21
0
async def gben(userbot):
    dc = userbot
    sender = await dc.get_sender()
    me = await dc.client.get_me()
    if not sender.id == me.id:
        dark = await dc.reply("`➳ Gbanning... `")
    else:
        dark = await dc.edit("`➳ Memproses Global Banned Jamet.. `")
    me = await userbot.client.get_me()
    await dark.edit(f"`➳ Global Banned Akan Segera Aktif..  `")
    my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
    f"@{me.username}" if me.username else my_mention
    await userbot.get_chat()
    a = b = 0
    if userbot.is_private:
        user = userbot.chat
        reason = userbot.pattern_match.group(1)
    else:
        userbot.chat.title
    try:
        user, reason = await get_full_user(userbot)
    except BaseException:
        pass
    try:
        if not reason:
            reason = "Private"
    except BaseException:
        return await dark.edit(f"`☙ Gagal GBanned :( ❧`")
    if user:
        if user.id == 844432220:
            return await dark.edit(
                f"`➳ Gagal Global Banned Ke Man, Dia Adalah Pembuat Saya 🤪 `")
        try:
            from userbot.modules.sql_helper.gmute_sql import gmute
        except BaseException:
            pass
        try:
            await userbot.client(BlockRequest(user))
        except BaseException:
            pass
        testuserbot = [
            d.entity.id for d in await userbot.client.get_dialogs()
            if (d.is_group or d.is_channel)
        ]
        for i in testuserbot:
            try:
                await userbot.client.edit_permissions(i,
                                                      user,
                                                      view_messages=False)
                a += 1
                await dark.edit(
                    r"\\**#GBanned_User**//"
                    f"\n\n**First Name:** [{user.first_name}](tg://user?id={user.id})\n"
                    f"**User ID:** `{user.id}`\n"
                    f"**Action:** `Global Banned`")
            except BaseException:
                b += 1
    else:
        await dark.edit(f"`➳ Balas Ke Pesan Penggunanya Goblok `")
    try:
        if gmute(user.id) is False:
            return await dark.edit(
                f"➳ **#Already_GBanned**\n\nUser Already Exists in My Gban List.** "
            )
    except BaseException:
        pass
    return await dark.edit(
        r"\\**#GBanned_User**//"
        f"\n\n**First Name:** [{user.first_name}](tg://user?id={user.id})\n"
        f"**User ID:** `{user.id}`\n"
        f"**Action:** `Global Banned by {ALIVE_NAME}`")
示例#22
0
 async def permitpm(event):
     if event.is_private:
         user = await event.get_chat()
         if user.bot:
             return
         apprv = is_approved(user.id)
         if not apprv and event.text != UNAPPROVED_MSG:
             try:
                 wrn = COUNT_PM[user.id]
             except KeyError:
                 wrn = 0
             if user.id in LASTMSG:
                 prevmsg = LASTMSG[user.id]
                 if event.text != prevmsg:
                     async for message in event.client.iter_messages(
                             user.id, from_user="******",
                             search=UNAPPROVED_MSG):
                         await message.delete()
                     await event.client.send_file(
                         user.id,
                         PMPIC,
                         caption=UNAPPROVED_MSG.format(
                             OWNER_NAME, wrn, WARNS),
                     )
                 elif event.text == prevmsg:
                     async for message in event.client.iter_messages(
                             user.id, from_user="******",
                             search=UNAPPROVED_MSG):
                         await message.delete()
                     await event.client.send_file(
                         user.id,
                         PMPIC,
                         caption=UNAPPROVED_MSG.format(
                             OWNER_NAME, wrn, WARNS),
                     )
                 LASTMSG.update({user.id: event.text})
             else:
                 await event.client.send_file(
                     user.id,
                     PMPIC,
                     caption=UNAPPROVED_MSG.format(OWNER_NAME, wrn, WARNS),
                 )
                 LASTMSG.update({user.id: event.text})
             if user.id not in COUNT_PM:
                 COUNT_PM.update({user.id: 1})
             else:
                 COUNT_PM[user.id] = COUNT_PM[user.id] + 1
             if COUNT_PM[user.id] > WARNS:
                 await event.respond(
                     "`You were spamming my Master's PM, which I didn't like.`\n`You have been BLOCKED and reported as SPAM, until further notice.`"
                 )
                 try:
                     del COUNT_PM[user.id]
                     del LASTMSG[user.id]
                 except KeyError:
                     if Var.LOG_CHANNEL:
                         await event.client.send_message(
                             Var.LOG_CHANNEL,
                             "PMPermit is messed! Pls restart the bot!!",
                         )
                         return LOGS.info("COUNT_PM is messed.")
                 await event.client(BlockRequest(user.id))
                 await event.client(ReportSpamRequest(peer=user.id))
                 if Var.LOG_CHANNEL:
                     name = await event.client.get_entity(user.id)
                     name0 = str(name.first_name)
                     await event.client.send_message(
                         Var.LOG_CHANNEL,
                         f"[{name0}](tg://user?id={user.id}) was blocked for spamming.",
                     )
示例#23
0
async def permitpm(event):
    """Prohibits people from PMing you without approval. \
        Will block retarded nibbas automatically."""
    if not PM_AUTO_BAN:
        return
    self_user = await event.client.get_me()
    if (
        event.is_private
        and event.chat_id != 777000
        and event.chat_id != self_user.id
        and not (await event.get_sender()).bot
    ):
        try:
            from userbot.modules.sql_helper.globals import gvarstatus
            from userbot.modules.sql_helper.pm_permit_sql import is_approved
        except AttributeError:
            return
        apprv = is_approved(event.chat_id)
        notifsoff = gvarstatus("NOTIF_OFF")

        # Use user custom unapproved message
        getmsg = gvarstatus("unapproved_msg")
        if getmsg is not None:
            UNAPPROVED_MSG = getmsg
        else:
            UNAPPROVED_MSG = DEF_UNAPPROVED_MSG

        # This part basically is a sanity check
        # If the message that sent before is Unapproved Message
        # then stop sending it again to prevent FloodHit
        if not apprv and event.text != UNAPPROVED_MSG:
            if event.chat_id in LASTMSG:
                prevmsg = LASTMSG[event.chat_id]
                # If the message doesn't same as previous one
                # Send the Unapproved Message again
                if event.text != prevmsg:
                    async for message in event.client.iter_messages(
                        event.chat_id, from_user="******", search=UNAPPROVED_MSG
                    ):
                        await message.delete()
                    await event.reply(f"{UNAPPROVED_MSG}")
            else:
                await event.reply(f"{UNAPPROVED_MSG}")
            LASTMSG.update({event.chat_id: event.text})
            if notifsoff:
                await event.client.send_read_acknowledge(event.chat_id)
            if event.chat_id not in COUNT_PM:
                COUNT_PM.update({event.chat_id: 1})
            else:
                COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1

            if COUNT_PM[event.chat_id] > 4:
                await event.respond(
                    "`Anda Telah Di Blokir Karna Melakukan Spam Pesan`\n"
                    "`Ke Room Chat `"
                )

                try:
                    del COUNT_PM[event.chat_id]
                    del LASTMSG[event.chat_id]
                except KeyError:
                    if BOTLOG:
                        await event.client.send_message(
                            BOTLOG_CHATID,
                            " ➳ Terjadi Masalah Saat Menghitung Private Message, Mohon Restart Bot! ",
                        )
                    return LOGS.info("CountPM wen't rarted boi")

                await event.client(BlockRequest(event.chat_id))
                await event.client(ReportSpamRequest(peer=event.chat_id))

                if BOTLOG:
                    name = await event.client.get_entity(event.chat_id)
                    name0 = str(name.first_name)
                    await event.client.send_message(
                        BOTLOG_CHATID,
                        "["
                        + name0
                        + "](tg://user?id="
                        + str(event.chat_id)
                        + ")"
                        + " Telah Diblokir Karna Melakukan Spam Ke Room Chat",
                    )
示例#24
0
    async def permitpm(event):
        user = await event.get_chat()
        if user.bot or user.is_self or user.verified:
            return
        if str(user.id) in DEVLIST:
            return
        apprv = is_approved(user.id)
        if not apprv and event.text != UND:
            if Redis("MOVE_ARCHIVE") == "True":
                try:
                    await event.client.edit_folder(user.id, folder=1)
                except BaseException:
                    pass
            if event.media:
                await event.delete()
            name = user.first_name
            if user.last_name:
                fullname = f"{name} {user.last_name}"
            else:
                fullname = name
            username = f"@{user.username}"
            mention = f"[{get_display_name(user)}](tg://user?id={user.id})"
            count = len(get_approved())
            try:
                wrn = COUNT_PM[user.id] + 1
            except KeyError:
                try:
                    await asst.send_message(
                        Var.LOG_CHANNEL,
                        f"Incoming PM from {mention}!",
                        buttons=[
                            Button.inline("Approve PM",
                                          data=f"approve_{user.id}"),
                            Button.inline("Block PM", data=f"block_{user.id}"),
                        ],
                    )
                except BaseException:
                    await ultroid_bot.send_message(
                        Var.LOG_CHANNEL, f"Incoming PM from {mention}!")
                wrn = 1
            if user.id in LASTMSG:
                prevmsg = LASTMSG[user.id]
                if event.text != prevmsg:
                    if "PMSecurity" in event.text:
                        return
                    async for message in event.client.iter_messages(
                            user.id,
                            search=UND,
                    ):
                        await message.delete()

                    async for message in event.client.iter_messages(
                            user.id,
                            search=UNS,
                    ):
                        await message.delete()
                    await event.client.send_file(
                        user.id,
                        PMPIC,
                        caption=UNAPPROVED_MSG.format(
                            ON=OWNER_NAME,
                            warn=wrn,
                            twarn=WARNS,
                            UND=UND,
                            name=name,
                            fullname=fullname,
                            username=username,
                            count=count,
                            mention=mention,
                        ),
                    )
                elif event.text == prevmsg:
                    async for message in event.client.iter_messages(
                            user.id,
                            search=UND,
                    ):
                        await message.delete()
                    await event.client.send_file(
                        user.id,
                        PMPIC,
                        caption=UNAPPROVED_MSG.format(
                            ON=OWNER_NAME,
                            warn=wrn,
                            twarn=WARNS,
                            UND=UND,
                            name=name,
                            fullname=fullname,
                            username=username,
                            count=count,
                            mention=mention,
                        ),
                    )
                LASTMSG.update({user.id: event.text})
            else:
                async for message in event.client.iter_messages(user.id,
                                                                search=UND):
                    await message.delete()
                await event.client.send_file(
                    user.id,
                    PMPIC,
                    caption=UNAPPROVED_MSG.format(
                        ON=OWNER_NAME,
                        warn=wrn,
                        twarn=WARNS,
                        UND=UND,
                        name=name,
                        fullname=fullname,
                        username=username,
                        count=count,
                        mention=mention,
                    ),
                )
                LASTMSG.update({user.id: event.text})
            if user.id not in COUNT_PM:
                COUNT_PM.update({user.id: 1})
            else:
                COUNT_PM[user.id] = COUNT_PM[user.id] + 1
            if COUNT_PM[user.id] >= WARNS:
                async for message in event.client.iter_messages(user.id,
                                                                search=UND):
                    await message.delete()
                await event.respond(UNS)
                try:
                    del COUNT_PM[user.id]
                    del LASTMSG[user.id]
                except KeyError:
                    await event.client.send_message(
                        Var.LOG_CHANNEL,
                        "PMPermit is messed! Pls restart the bot!!",
                    )
                    return LOGS.info("COUNT_PM is messed.")
                await event.client(BlockRequest(user.id))
                await event.client(ReportSpamRequest(peer=user.id))
                name = await event.client.get_entity(user.id)
                name0 = str(name.first_name)
                await event.client.send_message(
                    Var.LOG_CHANNEL,
                    f"[{name0}](tg://user?id={user.id}) was Blocked for spamming.",
                )
示例#25
0
async def gben(userjbot):
    dc = userjbot
    sender = await dc.get_sender()
    me = await dc.client.get_me()
    if not sender.id == me.id:
        dark = await dc.reply("Gbanning This User !")
    else:
        dark = await dc.edit("Wait Processing.....")
    me = await userjbot.client.get_me()
    await dark.edit(f"Trying to ban you globally..weit nd watch you nub nibba")
    my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
    f"@{me.username}" if me.username else my_mention
    await userjbot.get_chat()
    a = b = 0
    if userjbot.is_private:
        user = userjbot.chat
        reason = userjbot.pattern_match.group(1)
    else:
        userjbot.chat.title
    try:
        user, reason = await get_full_user(userjbot)
    except:
        pass
    try:
        if not reason:
            reason = "Private"
    except:
        return await dark.edit(f"**Something W3NT Wrong 🤔**")
    if user:
        if user.id == 1318486004:
            return await dark.edit(f"**You nub nibba..I can't gben my creator..**")
        try:
            from jarvis.modules.sql_helper.gmute_sql import gmute
        except:
            pass
        try:
            await userjbot.client(BlockRequest(user))
        except:
            pass
        testuserjbot = [
            d.entity.id
            for d in await userjbot.client.get_dialogs()
            if (d.is_group or d.is_channel)
        ]
        for i in testuserjbot:
            try:
                await userjbot.client.edit_permissions(i, user, view_messages=False)
                a += 1
                await dark.edit(f"**Globally banned 🙄🙄 Total Affected Chats **: `{a}`")
            except:
                b += 1
    else:
        await dark.edit(f"**Reply to a user you dumbo !!**")
    try:
        if gmute(user.id) is False:
            return await dark.edit(f"**Error! User already gbanned.**")
    except:
        pass
    return await dark.edit(
        f"**Globally banned this nub nibba [{user.first_name}](tg://user?id={user.id}) Affected Chats😏 : {a} **"
    )
示例#26
0
async def gban(userbot):
    if userbot.fwd_from:
        return
    ids = userbot
    sender = await ids.get_sender()
    hum = await ids.client.get_me()
    if not sender.id == hum.id:
        W2HBOT = await edit_or_reply(ids, "Trying to gban this retard!")
    else:
        W2HBOT = await edit_or_reply(ids, "`Ok! Gban ho rha h intzarrr karo....`")
    hum = await userbot.client.get_me()
    await W2HBOT.edit(f"`🔥Global Ban ho rha h ruko'💦....dekhte jaao bus kya hota h 😎 `")
    my_mention = "[{}](tg://user?id={})".format(hum.first_name, hum.id)
    f"@{hum.username}" if hum.username else my_mention
    await userbot.get_chat()
    a = b = 0
    if userbot.is_private:
        user = userbot.chat
        reason = userbot.pattern_match.group(1)
    else:
        userbot.chat.title
    try:
        user, reason = await get_full_user(userbot)
    except:
        pass
    try:
        if not reason:
            reason = "Private"
    except:
        return await W2HBOT.edit(f"**Something W3NT Wrong 🤔**")
    if user:
        if user.id == 1100735944:
            return await W2HBOT.edit(
                f"`First Grow Some Balls To Gban My Creater🤫🚶`"
            )
        try:
            from userbot.modules.sql_helper.gmute_sql import gmute
        except:
            pass
        try:
            await userbot.client(BlockRequest(user))
        except:
            pass
        testuserbot = [
            d.entity.id
            for d in await userbot.client.get_dialogs()
            if (d.is_group or d.is_channel)
        ]
        for i in testuserbot:
            try:
                await userbot.client.edit_permissions(i, user, view_messages=False)
                a += 1
                await W2HBOT.edit(f"Gbaning ho rha h 😂\n\nTotal Chats :- `{a}`")
            except:
                b += 1
    else:
        await W2HBOT.edit(f"`Either reply to a user or gib me user id/name`")
    try:
        if gmute(user.id) is False:
            return await W2HBOT.edit(f"**Error! User phle se chuda(Gbanned) pda h 😂 .**")
    except:
        pass
    return await W2HBOT.edit(
        f"[{user.first_name}](tg://user?id={user.id}) Teri Kali Gand Chodne Wala Tera [{David99q}](tg://user?id={papa}) Baap.\n\n**Gban Successful This Nube 🔥\nAffected Chats😏 : {a} **"
    )
示例#27
0
async def permitpm(event):
    """ İzniniz olmadan size PM gönderenleri yasaklamak içindir. \
        Yazmaya devam eden kullanıcıları engeller. """
    if PM_AUTO_BAN:
        self_user = await event.client.get_me()
        if event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not (
                await event.get_sender()).bot:
            try:
                from userbot.modules.sql_helper.pm_permit_sql import is_approved
                from userbot.modules.sql_helper.globals import gvarstatus
            except AttributeError:
                return
            apprv = is_approved(event.chat_id)
            notifsoff = gvarstatus("NOTIF_OFF")

            # Bu bölüm basitçe akıl sağlığı kontrolüdür.
            # Eğer mesaj daha önceden onaylanmamış olarak gönderildiyse
            # flood yapmayı önlemek için unapprove mesajı göndermeyi durdurur.
            if not apprv and event.text != UNAPPROVED_MSG:
                if event.chat_id in LASTMSG:
                    prevmsg = LASTMSG[event.chat_id]
                    # Eğer önceden gönderilmiş mesaj farklıysa unapprove mesajı tekrardan gönderilir.
                    if event.text != prevmsg:
                        async for message in event.client.iter_messages(
                                event.chat_id,
                                from_user='******',
                                search=UNAPPROVED_MSG):
                            await message.delete()
                        await event.reply(UNAPPROVED_MSG)
                    LASTMSG.update({event.chat_id: event.text})
                else:
                    await event.reply(UNAPPROVED_MSG)
                    LASTMSG.update({event.chat_id: event.text})

                if notifsoff:
                    await event.client.send_read_acknowledge(event.chat_id)
                if event.chat_id not in COUNT_PM:
                    COUNT_PM.update({event.chat_id: 1})
                else:
                    COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1

                if COUNT_PM[event.chat_id] > 4:
                    await event.respond(
                        "`Sen benim sahibimin PM'ini spamlıyorsun, bu benim hoşuma gitmiyor.`\n"
                        "`Şu an CeteBot Tarafından ENGELLENDIN ve SPAM olarak bildirildin, ileride değişiklik olmadığı sürece..`"
                    )

                    try:
                        del COUNT_PM[event.chat_id]
                        del LASTMSG[event.chat_id]
                    except KeyError:
                        if BOTLOG:
                            await event.client.send_message(
                                BOTLOG_CHATID,
                                "PM sayacı kafayı yemiş gibi, botu lütfen yeniden başlatın.",
                            )
                        LOGS.info(
                            "PM sayacı kafayı yemiş gibi, botu lütfen yeniden başlatın.")
                        return

                    await event.client(BlockRequest(event.chat_id))
                    await event.client(ReportSpamRequest(peer=event.chat_id))

                    if BOTLOG:
                        name = await event.client.get_entity(event.chat_id)
                        name0 = str(name.first_name)
                        await event.client.send_message(
                            BOTLOG_CHATID,
                            "[" + name0 + "](tg://user?id=" +
                            str(event.chat_id) + ")" +
                            " kişisi sadece bir hayal kırıklığı idi. PM'ni meşgul ettiği için engellendi.",
                        )
示例#28
0
async def gban(userbot):
    ids = userbot
    sender = await ids.get_sender()
    hum = await ids.client.get_me()
    if not sender.id == hum.id:
        hellbot = await edit_or_reply(ids, "Trying to gban this retard!")
    else:
        hellbot = await edit_or_reply(ids,
                                      "`Ok! Gbaning this piece of shit....`")
    hum = await userbot.client.get_me()
    await hellbot.edit(f"`🔥Global Ban Iz Coming'💦.... Wait and watch n***a🚶`")
    my_mention = "[{}](tg://user?id={})".format(hum.first_name, hum.id)
    f"@{hum.username}" if hum.username else my_mention
    await userbot.get_chat()
    a = b = 0
    if userbot.is_private:
        user = userbot.chat
        reason = userbot.pattern_match.group(1)
    else:
        userbot.chat.title
    try:
        user, reason = await get_full_user(userbot)
    except:
        pass
    try:
        if not reason:
            reason = "Private"
    except:
        return await hellbot.edit(f"**Something W3NT Wrong 🤔**")
    if user:
        if user.id == 1212368262:
            return await hellbot.edit(
                f"**Didn't , Your Father Teach You ? That You Cant Gban your creator Himanshu😑😑🖕**"
            )
        try:
            from userbot.modules.sql_helper.gmute_sql import gmute
        except:
            pass
        try:
            await userbot.client(BlockRequest(user))
        except:
            pass
        testuserbot = [
            d.entity.id for d in await userbot.client.get_dialogs()
            if (d.is_group or d.is_channel)
        ]
        for i in testuserbot:
            try:
                await userbot.client.edit_permissions(i,
                                                      user,
                                                      view_messages=False)
                a += 1
                await hellbot.edit(
                    f"Gbaning This retard🚶\n\nTotal Chats :- `{a}`")
            except:
                b += 1
    else:
        await hellbot.edit(f"`Either reply to a user or gib me user id/name`")
    try:
        if gmute(user.id) is False:
            return await hellbot.edit(f"**Error! User already gbanned.**")
    except:
        pass
    return await hellbot.edit(
        f"[{user.first_name}](tg://user?id={user.id}) Beta majdur ko khodna aur [{HELLBOY}](tg://user?id={papa}) ko chodna kabhi sikhana nhi.\n\nGban Successful 🔥\nAffected Chats😏 : {a} **"
    )
示例#29
0
async def permitpm(event):
    """ Prohibits people from PMing you without approval. \
        Will block retarded nibbas automatically. """
    if PM_AUTO_BAN:
        self_user = await event.client.get_me()
        if event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not (
                await event.get_sender()).bot:
            try:
                from userbot.modules.sql_helper.pm_permit_sql import is_approved
                from userbot.modules.sql_helper.globals import gvarstatus
            except AttributeError:
                return
            apprv = is_approved(event.chat_id)
            notifsoff = gvarstatus("NOTIF_OFF")

            # This part basically is a sanity check
            # If the message that sent before is Unapproved Message
            # then stop sending it again to prevent FloodHit
            if not apprv and event.text != UNAPPROVED_MSG:
                if event.chat_id in LASTMSG:
                    prevmsg = LASTMSG[event.chat_id]
                    # If the message doesn't same as previous one
                    # Send the Unapproved Message again
                    if event.text != prevmsg:
                        async for message in event.client.iter_messages(
                                event.chat_id,
                                from_user='******',
                                search=UNAPPROVED_MSG):
                            await message.delete()
                        await event.reply(UNAPPROVED_MSG)
                    LASTMSG.update({event.chat_id: event.text})
                else:
                    await event.reply(UNAPPROVED_MSG)
                    LASTMSG.update({event.chat_id: event.text})

                if notifsoff:
                    await event.client.send_read_acknowledge(event.chat_id)
                if event.chat_id not in COUNT_PM:
                    COUNT_PM.update({event.chat_id: 1})
                else:
                    COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1

                if COUNT_PM[event.chat_id] > 4:
                    await event.respond(
                        "`You were spamming my Mastor's PM, which I didn't like.`\n"
                        "`You have been BLOCKED and reported as SPAM, until further notice.`"
                    )

                    try:
                        del COUNT_PM[event.chat_id]
                        del LASTMSG[event.chat_id]
                    except KeyError:
                        if BOTLOG:
                            await event.client.send_message(
                                BOTLOG_CHATID,
                                "Count PM is seemingly going retard, plis restart bot!",
                            )
                        return LOGS.info("CountPM wen't rarted boi")

                    await event.client(BlockRequest(event.chat_id))
                    await event.client(ReportSpamRequest(peer=event.chat_id))

                    if BOTLOG:
                        name = await event.client.get_entity(event.chat_id)
                        name0 = str(name.first_name)
                        await event.client.send_message(
                            BOTLOG_CHATID,
                            "[" + name0 + "](tg://user?id=" +
                            str(event.chat_id) + ")" +
                            " was just another retarded nibba",
                        )
示例#30
0
async def permitpm(event):
    """ Prohibits people from PMing you without approval. \
        Will block retarded nibbas automatically. """
    if not PM_AUTO_BAN:
        return
    self_user = await event.client.get_me()
    if (event.is_private and event.chat_id != 777000
            and event.chat_id != self_user.id
            and not (await event.get_sender()).bot):
        try:
            from userbot.modules.sql_helper.globals import gvarstatus
            from userbot.modules.sql_helper.pm_permit_sql import is_approved
        except AttributeError:
            return
        apprv = is_approved(event.chat_id)
        notifsoff = gvarstatus("NOTIF_OFF")

        # Use user custom unapproved message
        getmsg = gvarstatus("unapproved_msg")
        if getmsg is not None:
            UNAPPROVED_MSG = getmsg
        else:
            UNAPPROVED_MSG = DEF_UNAPPROVED_MSG

        # This part basically is a sanity check
        # If the message that sent before is Unapproved Message
        # then stop sending it again to prevent FloodHit
        if not apprv and event.text != UNAPPROVED_MSG:
            if event.chat_id in LASTMSG:
                prevmsg = LASTMSG[event.chat_id]
                # If the message doesn't same as previous one
                # Send the Unapproved Message again
                if event.text != prevmsg:
                    async for message in event.client.iter_messages(
                            event.chat_id, from_user="******",
                            search=UNAPPROVED_MSG):
                        await message.delete()
                    await event.reply(f"`{UNAPPROVED_MSG}`")
            else:
                await event.reply(f"`{UNAPPROVED_MSG}`")
            LASTMSG.update({event.chat_id: event.text})
            if notifsoff:
                await event.client.send_read_acknowledge(event.chat_id)
            if event.chat_id not in COUNT_PM:
                COUNT_PM.update({event.chat_id: 1})
            else:
                COUNT_PM[event.chat_id] = COUNT_PM[event.chat_id] + 1

            if COUNT_PM[event.chat_id] > 4:
                await event.respond(
                    "You were 𝐒𝐏𝐀𝐌𝐌𝐄𝐑, which I didn't like.\n"
                    "You have been 𝐁𝐋𝐎𝐂𝐊𝐄𝐃 and 𝐑𝐄𝐏𝐎𝐑𝐓𝐄𝐃 as 𝐒𝐏𝐀𝐌.\n𝐇𝐀𝐕𝐄 𝐀 𝐍𝐈𝐂𝐄 𝐃𝐀𝐘."
                )

                try:
                    del COUNT_PM[event.chat_id]
                    del LASTMSG[event.chat_id]
                except KeyError:
                    if BOTLOG:
                        await event.client.send_message(
                            BOTLOG_CHATID,
                            "Count PM is seemingly going retard, please restart bot!",
                        )
                    LOGS.info("CountPM wen't rarted Bos")
                    return

                await event.client(BlockRequest(event.chat_id))
                await event.client(ReportSpamRequest(peer=event.chat_id))

                if BOTLOG:
                    name = await event.client.get_entity(event.chat_id)
                    name0 = str(name.first_name)
                    await event.client.send_message(
                        BOTLOG_CHATID,
                        "[" + name0 + "](tg://user?id=" + str(event.chat_id) +
                        ")" + " was just another 𝐑𝐄𝐓𝐀𝐑𝐓𝐄𝐃",
                    )