async def endgmute(event): private = False if event.is_private: await eor(event, "`Trying to ungmute !!`") await asyncio.sleep(2) private = True reply = await event.get_reply_message() if event.pattern_match.group(1) is not None: userid = event.pattern_match.group(1) elif reply is not None: userid = reply.sender_id elif private is True: userid = event.chat_id else: return await eod( event, "Please reply to a user or add their into the command to ungmute them.", ) name = (await event.client.get_entity(userid)).first_name event.chat_id if not gsql.is_gmuted(userid, "gmute"): return await eod(event, "I don't remember I gmuted him...") try: gsql.ungmute(userid, "gmute") except Exception as e: await eod(event, "Error occured!\nError is " + str(e)) else: await eor(event, f"**Unmuted [{name}](tg://user?id={userid}) Globally !!**")
async def ungmute(eventUnGmute): if not eventUnGmute.text[0].isalpha() and eventUnGmute.text[0] \ not in ("/", "#", "@", "!"): chat = await eventUnGmute.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: await eventUnGmute.edit("`I am not an admin!`") return try: from userbot.plugins.sql_helper.gmute_sql import ungmute except AttributeError: await eventUnGmute.edit("`Running on Non-SQL mode!`") return user = await get_user_from_event(eventUnGmute) if user: pass else: return await eventUnGmute.edit('```Ungmuting...```') if ungmute(user.id) is False: await eventUnGmute.edit("`Error! User probably not gmuted.`") else: await eventUnGmute.edit("```Ungmuted Successfully```") if ENABLE_LOG: await eventUnGmute.client.send_message( LOGGING_CHATID, "#UNGMUTE\n" f"USER: [{user.first_name}](tg://user?id={user.id})\n" f"CHAT: {eventUnGmute.chat.title}(`{eventUnGmute.chat_id}`)" )
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) ; 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"**Error! Unknown user.**") if user: if user.id == 667805879: return await rkp.edit(f"**Error! cant ungban this user.**") try: from userbot.plugins.sql_helper.gmute_sql import ungmute except: pass try: await rk.client(UnblockRequest(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, send_messages=True) a += 1 await rkp.edit(f"**Requesting to ungban user!\nUnGbanned in {a} chats.....**") except: 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: pass return await rkp.edit(f"**UnGbanned** [{user.first_name}](tg://user?id={user.id}) **in {a} chat(s) , UnBlocked and removed user from Gban watch **")
async def ungmoot(un_gmute): if un_gmute.fwd_from: return """ For .ungmute command, ungmutes the target in the userbot """ # Admin or creator check chat = await un_gmute.get_chat() admin = chat.admin_rights creator = chat.creator # If not admin and not creator, return if not admin and not creator: await un_gmute.edit(NO_ADMIN) return # Check if the function running under SQL mode try: from userbot.plugins.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}`)", )
async def gunban(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: shinchanbot = await edit_or_reply(ids, "`Trying to ungban this kid...`") else: shinchanbot = await edit_or_reply(ids, "`Ungban in progress...`") hum = await userbot.client.get_me() await shinchanbot.edit(f"`Trying to ungban this kiddo...`") 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 shinchanbot.edit("**Som3ting W3nt Wr0ng**") if user: if user.id == 816517310 or user.id == 1212368262: return await shinchanbot.edit( "**You need to grow some balls to gban / ungban my creator and his freands**" ) try: from userbot.plugins.sql_helper.gmute_sql import ungmute except: pass try: await userbot.client(UnblockRequest(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, send_messages=True) a += 1 await shinchanbot.edit( f"Ok! Now Ungbaning this kiddo.\n\n**Please Wait Few Minutes**😏" ) except: b += 1 else: await shinchanbot.edit("**Reply to a user**") try: if ungmute(user.id) is False: return await shinchanbot.edit( "**Error! I think User already ungbanned.**") except: pass return await shinchanbot.edit( f"**[{user.first_name}](tg://user?id={user.id}) Aur bhai.... Aagya swaad.**\n\nUngban Successful 🔥\nChats :- `{a}`" )
async def gspider(tamilbot): lol = tamilbot sender = await lol.get_sender() me = await lol.client.get_me() if not sender.id == me.id: tamil = await lol.reply("`Wait Let Me Process`") else: tamil = await lol.edit("One Min ! ") me = await tamilbot.client.get_me() await tamil.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 tamilbot.get_chat() a = b = 0 if tamilbot.is_private: user = tamilbot.chat reason = tamilbot.pattern_match.group(1) else: tamilbot.chat.title try: user, reason = await get_full_user(tamilbot) except: pass try: if not reason: reason = "Private" except: return await tamil.edit("Someting Went Wrong 🤔") if user: if user.id == 1169076058 or user.id == 1492186775: return await tamil.edit("**You Cant Ungban A Dev !**") try: from userbot.plugins.sql_helper.gmute_sql import ungmute except: pass try: await tamilbot.client(UnblockRequest(user)) except: pass testtamilbot = [ d.entity.id for d in await tamilbot.client.get_dialogs() if (d.is_group or d.is_channel) ] for i in testtamilbot: try: await tamilbot.client.edit_permissions(i, user, send_messages=True) a += 1 await tamil.edit(f"**UNGBANNING\nAFFECTED CHATS - {a} **") except: b += 1 else: await tamil.edit("**Reply to a user !!**") try: if ungmute(user.id) is False: return await tamil.edit( "**Error! User probably already ungbanned.**") except: pass return await tamil.edit( f"**🔹UNGBANNED\n🔹USER - [{user.first_name}](tg://user?id={user.id}) \n🔹CHATS : {a} **" )
async def gunben(userbot): dc = userbot sender = await dc.get_sender() me = await dc.client.get_me() if not sender.id == me.id: dark = await dc.reply("`Wait Let Me ungban this nub nibba again😂`") else: dark = await dc.edit("Weit nd watch ! ") me = await userbot.client.get_me() await dark.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 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 dark.edit("Someting Went Wrong 🤔") if user: if user.id == 1311769691: return await dark.edit( "**You nub nibba..can't gban or ungban my creator... !**") try: from userbot.plugins.sql_helper.gmute_sql import ungmute except: pass try: await userbot.client(UnblockRequest(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, send_messages=True) a += 1 await dark.edit( f"**Ungbaning this nub nibba.. AFFECTED CHATS - {a} **") except: b += 1 else: await dark.edit("**Reply to a user you dumbo**") try: if ungmute(user.id) is False: return await dark.edit("**Error! User already ungbanned.**") except: pass return await dark.edit( f"**Ungbanned this noon nibba..getting him another chance... ; USER - [{user.first_name}](tg://user?id={user.id}) CHATS : {a} **" )