Ejemplo n.º 1
0
async def ungbun(event):
    await event.edit("**Un-GBanning User**")
    sucess = 0
    bad = 0
    user, reason = await get_user_from_event(event)
    if not user.id:
        await event.edit("`Mention A User To Un-Gban`")
        return
    if user.id == bot.uid:
        await event.edit("**I Can't Un-Gban You Master :(**")
        return
    if not gban_sql.is_gbanned(user.id):
        await event.edit(
            "**This User Is Not Gbanned. No Point In Un-Gbanning !**")
        return
    gban_sql.ungban_user(user.id)
    chat_s = await get_all_admin_chats(event)
    len_s = len(chat_s)
    await event.edit(
        f"**Un-GBanning !** [{user.first_name}](tg://user?id={user.id}) **in {len_s} Chats!**"
    )
    for stark_s in chat_s:
        try:
            await event.client.edit_permissions(stark_s,
                                                user.id,
                                                view_messages=True)
            sucess += 1
        except:
            bad += 0
    await event.edit(
        f"**Un-GBanned !**[{user.first_name}](tg://user?id={user.id}) **in {len_s} Chats!**"
    )
Ejemplo n.º 2
0
async def gbun(event):
    if event.fwd_from:
        return
    o = await all_pro_s(Config, client2, client3, client4)
    stime = time.time()
    await event.edit("**GBanning This User !**")
    sucess = 0
    bad = 0
    user, reason = await get_user_from_event(event)
    if not user:
        await event.edit("`Kindly, Mention A User To Gban`")
        return
    if not reason or reason is None:
        hmm_r = "#GBanned"
    elif reason:
        hmm_r = reason
    if user.id in o:
        await event.edit("**I Can't Gban You Master / Sudo Users :(**")
        return
    if gban_sql.is_gbanned(user.id):
        await event.edit(
            "**This User Is Already Gbanned. No Point In Gbanning Him Again ! :/**"
        )
        return
    gban_sql.gban_user(user.id, hmm_r)
    chat_s = await get_all_admin_chats(event)
    if len(chat_s) == 0:
        await event.edit(
            "**You Need To Be Admin In Atleast 1 Group To Perform this Action !**"
        )
        return
    len_s = len(chat_s)
    await event.edit(
        f"**Trying To GBan !** [{user.first_name}](tg://user?id={user.id}) **in {len_s} Chats!**"
    )
    for stark_s in chat_s:
        try:
            await event.client.edit_permissions(stark_s,
                                                user.id,
                                                view_messages=False)
            sucess += 1
        except:
            bad += 0
    etime = time.time()
    hmm_time = round(etime - stime)
    await event.edit(
        f"**GBanned Successfully !** \n\n"
        f"**User :** [{user.first_name}](tg://user?id={user.id}) \n"
        f"**Affected Chats :** `{sucess}` \n"
        f"**Time Taken :** `{hmm_time}` \n"
        f"**Reason :** `{reason}` \n"
        f"This User Will Be Banned Incase Of Joining Any Groups Where You Are Admin in Future."
    )
Ejemplo n.º 3
0
async def mi(event):
    sed = event.sender_id
    if await is_admin(event):
        if gban_sql.is_gbanned(sed):
            try:
                await event.client.edit_permissions(event.chat_id,
                                                    sed,
                                                    view_messages=False)
                await event.reply(
                    f"**#GBanned-User** \nUserID : {sed} \nReason : {gban_sql.is_gbanned(sed)}"
                )
            except:
                pass
Ejemplo n.º 4
0
async def mi(event):
    sed = event.sender_id
    hmm = await bot.get_me()
    if event.is_private:
        return
    if await is_admin(event, hmm.id):
        if gban_sql.is_gbanned(sed):
            try:
                await event.client.edit_permissions(event.chat_id,
                                                    sed,
                                                    view_messages=False)
            except:
                pass
Ejemplo n.º 5
0
async def starky(event):
    if event.user_joined:
        if await is_admin(event):
            sadly = await event.get_user()
            if gban_sql.is_gbanned(sadly.id):
                try:
                    await event.client.edit_permissions(event.chat_id,
                                                        sadly.id,
                                                        view_messages=False)
                    await event.reply(
                        f"**#GBanned-User** \nUserID : {sadly.id} \nReason : {gban_sql.is_gbanned(sadly.id)}"
                    )
                except:
                    pass
Ejemplo n.º 6
0
async def gbun(event):
    if event.fwd_from:
        return
    o = await all_pro_s(Config, client2, client3, client4)
    await event.edit("**GBanning User**")
    sucess = 0
    bad = 0
    user, reason = await get_user_from_event(event)
    if not user.id:
        await event.edit("`Mention A User To Gban`")
        return
    if not reason:
        hmm_r = "#GBanned"
    elif reason:
        hmm_r = reason
    if user.id in o:
        await event.edit("**I Can't Gban You Master :(**")
        return
    if gban_sql.is_gbanned(user.id):
        await event.edit(
            "**This User Is Already Gbanned. No Point In Gbanning Him Again !**"
        )
        return
    gban_sql.gban_user(user.id, hmm_r)
    chat_s = await get_all_admin_chats(event)
    if len(chat_s) == 0:
        await event.edit(
            "**You Need To Be Admin In Atleast 1 Group To Perform this Action**"
        )
        return
    len_s = len(chat_s)
    await event.edit(
        f"**GBanning !** [{user.first_name}](tg://user?id={user.id}) **in {len_s} Chats!**"
    )
    for stark_s in chat_s:
        try:
            await event.client.edit_permissions(stark_s,
                                                user.id,
                                                view_messages=False)
            sucess += 1
        except:
            bad += 0
    await event.edit(
        f"**GBanned !**[{user.first_name}](tg://user?id={user.id}) **in {sucess} Chats!**"
    )
Ejemplo n.º 7
0
async def ungbun(event):
    if event.fwd_from:
        return
    await event.edit("**Un-GBanning User**")
    sucess = 0
    bad = 0
    o = await all_pro_s(Config, client2, client3, client4)
    stime = time.time()
    user, reason = await get_user_from_event(event)
    if not user.id:
        await event.edit("`Mention A User To Un-Gban`")
        return
    if user.id in o:
        await event.edit("**I Can't Un-Gban You Master :(**")
        return
    if not gban_sql.is_gbanned(user.id):
        await event.edit(
            "**This User Is Not Gbanned. No Point In Un-Gbanning !**")
        return
    gban_sql.ungban_user(user.id)
    chat_s = await get_all_admin_chats(event)
    if len(chat_s) == 0:
        await event.edit(
            "**You Need To Be Admin In Atleast 1 Group To Perform this Action**"
        )
        return
    len_s = len(chat_s)
    await event.edit(
        f"**Un-GBanning !** [{user.first_name}](tg://user?id={user.id}) **in {len_s} Chats!**"
    )
    for stark_s in chat_s:
        try:
            await event.client.edit_permissions(stark_s,
                                                user.id,
                                                view_messages=True)
            sucess += 1
        except:
            bad += 0
    etime = time.time()
    hmm_time = round(etime - stime)
    await event.edit(
        f"**Un-GBanned Successfully !** \n\n"
        f"**User :** [{user.first_name}](tg://user?id={user.id}) \n"
        f"**Affected Chats :** `{sucess}` \n"
        f"**Time Taken :** `{hmm_time}`")
Ejemplo n.º 8
0
async def gbun(event):
    await event.edit("**GBanning User**")
    sucess = 0
    bad = 0
    user, reason = await get_user_from_event(event)
    if not user.id:
        await event.edit("`Mention A User To Gban`")
        return
    if not reason:
        hmm_r = "#GBanned"
    elif reason:
        hmm_r = reason
    if user.id == bot.uid:
        await event.edit("**I Can't Gban You Master :(**")
        return
    if gban_sql.is_gbanned(user.id):
        await event.edit(
            "**This User Is Already Gbanned. No Point In Gbanning Him Again !**"
        )
        return
    gban_sql.gban_user(user.id, hmm_r)
    chat_s = await get_all_admin_chats(event)
    len_s = len(chat_s)
    await event.edit(
        f"**GBanning !** [{user.first_name}](tg://user?id={user.id}) **in {len_s} Chats!**"
    )
    for stark_s in chat_s:
        try:
            await event.client.edit_permissions(stark_s,
                                                user.id,
                                                view_messages=False)
            sucess += 1
        except:
            bad += 0
    await event.edit(
        f"**GBanned !**[{user.first_name}](tg://user?id={user.id}) **in {len_s} Chats!**"
    )
Ejemplo n.º 9
0
async def _(event):
    if event.fwd_from:
        return
    replied_user, error_i_a = await get_full_user(event)
    if replied_user is None:
        await friday.edit_or_reply(event, str(error_i_a))
        return False
    replied_user_profile_photos = await borg(
        GetUserPhotosRequest(user_id=replied_user.user.id,
                             offset=42,
                             max_id=0,
                             limit=80))
    replied_user_profile_photos_count = "None"
    try:
        replied_user_profile_photos_count = replied_user_profile_photos.count
    except AttributeError:
        pass
    user_id = replied_user.user.id
    first_name = html.escape(replied_user.user.first_name)
    if first_name is not None:
        first_name = first_name.replace("\u2060", "")
    last_name = replied_user.user.last_name
    last_name = (last_name.replace("\u2060", "") if last_name else
                 ("Last Name not found"))
    user_bio = replied_user.about
    if user_bio is not None:
        user_bio = html.escape(replied_user.about)
    common_chats = replied_user.common_chats_count
    try:
        dc_id, location = get_input_location(replied_user.profile_photo)
    except Exception as e:
        dc_id = "Unknown."
        str(e)
    shazam = replied_user_profile_photos_count
    if is_gbanned(user_id):
        is_gbanned_s = f"This User Is Gbanned For Reason : {is_gbanned}"
    elif not is_gbanned(user_id):
        is_gbanned_s = False
    if is_muted(user_id, "gmute"):
        is_gmutted = "User is Tapped."
    elif not is_muted(user_id, "gmute"):
        is_gmutted = False
    caption = f"""<b>INFO<b>
<b>Telegram ID</b>: <code>{user_id}</code>
<b>Permanent Link</b>: <a href='tg://user?id={user_id}'>Click Here</a>
<b>First Name</b>: <code>{first_name}</code>
<b>Second Name</b>: <code>{last_name}</code>
<b>BIO</b>: <code>{user_bio}</code>
<b>DC ID</b>: <code>{dc_id}</code>
<b>NO OF PSS</b>: <code>{shazam}</code>
<b>IS RESTRICTED</b>: <code>{replied_user.user.restricted}</code>
<b>VERIFIED</b>: <code>{replied_user.user.verified}</code>
<b>IS A BOT</b>: <code>{replied_user.user.bot}</code>
<b>Groups in Common</b>: <code>{common_chats}</code>
<b>Is Gbanned</b>: <code>{is_gbanned_s}</code>
<b>Is Gmutted</b>: <code>{is_gmutted}</code>
"""
    message_id_to_reply = event.message.reply_to_msg_id
    if not message_id_to_reply:
        message_id_to_reply = event.message.id
    await borg.send_message(
        event.chat_id,
        caption,
        reply_to=message_id_to_reply,
        parse_mode="HTML",
        file=replied_user.profile_photo,
        force_document=False,
        silent=True,
    )
    await event.delete()