Example #1
0
async def ungmoot(un_gmute):
    """ For .ungmute command, ungmutes the target in the WhiteEyeUserBot """
    # Admin or creator check
    await un_gmute.get_chat()
    # Check if the function running under SQL mode
    try:
        from WhiteEyeUserBot.modules.sql_helper.gmute_sql import ungmute
    except AttributeError:
        await un_gmute.edit(NO_SQL)
        return

    user = await get_user_from_event(un_gmute)
    user = user[0]
    if user:
        pass
    else:
        return

    # If pass, inform and start ungmuting
    await un_gmute.edit("```Ungmuting...```")

    if ungmute(user.id) is False:
        await un_gmute.edit("`Error! User probably not gmuted.`")
    else:
        # Inform about success
        await un_gmute.edit("```Ungmuted Successfully```")

        if BOTLOG:
            await un_gmute.client.send_message(
                BOTLOG_CHATID,
                "#UNGMUTE\n"
                f"USER: [{user.first_name}](tg://user?id={user.id})\n"
                f"CHAT: {un_gmute.chat.title}(`{un_gmute.chat_id}`)",
            )
Example #2
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("`Wait Let Me Process`")
    else:
        WhiteEye = await lol.edit("One Min ! ")
    me = await WhiteEyeUserBot.client.get_me()
    await WhiteEye.edit(f"Trying To Ungban User !")
    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("Someting Went Wrong 🤔")
    if user:
        if user.id == 1263617196:
            return await WhiteEye.edit("**You Cant Ungban A Dev !**")
        try:
            from WhiteEyeUserBot.modules.sql_helper.gmute_sql import ungmute
        except:
            pass
        try:
            await WhiteEyeUserBot.client(UnblockRequest(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, send_messages=True)
                a += 1
                await WhiteEye.edit(f"**UNGBANNING // AFFECTED CHATS - {a} **")
            except:
                b += 1
    else:
        await WhiteEye.edit("**Reply to a user !!**")
    try:
        if ungmute(user.id) is False:
            return await WhiteEye.edit("**Error! User probably already ungbanned.**")
    except:
        pass
    return await WhiteEye.edit(
        f"**UNGBANNED // USER - [{user.first_name}](tg://user?id={user.id}) CHATS : {a} **"
    )
Example #3
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"**Requesting  to ungban 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(f"**Error! Unknown user.**")
    if user:
        if user.id == 890155093:
            return await rkp.edit(f"**Error! cant ungban this user.**")
        try:
            from WhiteEyeUserBot.modules.sql_helper.gmute_sql import ungmute
        except BaseException:
            pass
        try:
            await rk.client(UnblockRequest(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"**Requesting  to ungban user!\nUnban in progress...**"
                       )
        for i in testrk:
            try:
                await rk.client.edit_permissions(i, user, send_messages=True)
                a += 1
            except BaseException:
                b += 1
    else:
        await rkp.edit(f"**Reply to a user !! **")
    try:
        if ungmute(user.id) is False:
            return await rkp.edit(
                f"**Error! User probably already ungbanned.**")
    except BaseException:
        pass
    return await rkp.edit(
        f"**UnGbanned** [{user.first_name}](tg://user?id={user.id}) **\nChats affected - {a}\nUnBlocked and removed user from Gban watch **"
    )