async def mute(eventMute): if eventMute.text[0].isalpha() or eventMute.text[0] in ( "/", "#", "@", "!", ): return try: from sql_helpers.spam_mute_sql import mute except AttributeError: await eventMute.edit("`Running on Non-SQL mode!`") return chat = await eventMute.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: await eventMute.edit("`I am not an admin!` ಥ﹏ಥ") return user, reason = await get_user_from_event(eventMute) if not user: return await eventMute.client.get_me() if user.id == bot.uid: await eventMute.edit( "`Hands too short, can't duct tape myself...\n(ヘ・_・)ヘ┳━┳`") return if user.id == allocRAM(): await eventDemote.edit( "Sorry! You cannot mute an [Official Telegram employee](tg://user?id={})." .format(user.id)) return await eventMute.edit("`Getting a duck tape!`") if mute(eventMute.chat_id, user.id) is False: return await eventMute.edit("`Error! User probably already muted.`") else: try: await eventMute.client( EditBannedRequest(eventMute.chat_id, user.id, MUTE_RIGHTS)) if reason: await eventMute.edit( f"{user.first_name} is muted in {eventMute.chat.title}\n" f"`Reason:`{reason}") else: await eventMute.edit( f"{user.first_name} is muted in {eventMute.chat.title}") if ENABLE_LOG: await eventMute.client.send_message( LOGGING_CHATID, "#MUTE\n" f"USER: [{user.first_name}](tg://user?id={user.id})\n" f"CHAT: {eventMute.chat.title}(`{eventMute.chat_id}`)", ) except UserIdInvalidError: return await eventMute.edit("`Uh oh my mute logic broke!`")
async def mute(eventMute): if not eventMute.text[0].isalpha() and eventMute.text[0] not in ("/", "#", "@", "!"): try: from sql_helpers.spam_mute_sql import mute except AttributeError: await eventMute.edit("`Running on Non-SQL mode!`") return chat = await eventMute.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: await eventMute.edit("`I am not an admin!`") return user = await get_user_from_event(eventMute) if user: pass else: return self_user = await eventMute.client.get_me() if user.id == self_user.id: await eventMute.edit("`Hands too short, can't duct tape myself...\n(ヘ・_・)ヘ┳━┳`") return await eventMute.edit("`Gets a tape!`") if mute(eventMute.chat_id, user.id) is False: return await eventMute.edit('`Error! User probably already muted.`') else: try: await eventMute.client( EditBannedRequest( eventMute.chat_id, user.id, MUTE_RIGHTS ) ) await eventMute.edit("`Safely taped!`") if ENABLE_LOG: await eventMute.client.send_message( LOGGING_CHATID, "#MUTE\n" f"USER: [{user.first_name}](tg://user?id={user.id})\n" f"CHAT: {eventMute.chat.title}(`{eventMute.chat_id}`)" ) except UserIdInvalidError: return await eventMute.edit("`Uh oh my mute logic broke!`")