def gmute(bot: Bot, update: Update, args: List[str]): message = update.effective_message # type: Optional[Message] user_id, reason = extract_user_and_text(message, args) if not user_id: message.reply_text("You don't seem to be referring to a user.") return if int(user_id) in SUDO_USERS: message.reply_text( "I spy, with my little eye... a sudo user war! Why are you guys turning on each other?" ) return if int(user_id) in SUPPORT_USERS: message.reply_text( "OOOH someone's trying to gmute a support user! *grabs popcorn*") return if user_id == bot.id: message.reply_text( "-_- So funny, lets gmute myself why don't I? Nice try.") return try: user_chat = bot.get_chat(user_id) except BadRequest as excp: message.reply_text(excp.message) return if user_chat.type != 'private': message.reply_text("That's not a user!") return if sql.is_user_gmuted(user_id): if not reason: message.reply_text( "This user is already gmuted; I'd change the reason, but you haven't given me one..." ) return old_reason = sql.update_gmute_reason( user_id, user_chat.username or user_chat.first_name, reason) if old_reason: message.reply_text( "This user is already gmuted, for the following reason:\n" "<code>{}</code>\n" "I've gone and updated it with your new reason!".format( html.escape(old_reason)), parse_mode=ParseMode.HTML) else: message.reply_text( "This user is already gmuted, but had no reason set; I've gone and updated it!" ) return message.reply_text("*Blows dust off of mutehammer* 😉") muter = update.effective_user # type: Optional[User] send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "{} is gmuting user {} " "because:\n{}".format( mention_html(muter.id, muter.first_name), mention_html(user_chat.id, user_chat.first_name), reason or "No reason given"), html=True) sql.gmute_user(user_id, user_chat.username or user_chat.first_name, reason) chats = get_all_chats() for chat in chats: chat_id = chat.chat_id # Check if this group has disabled gmutes if not sql.does_chat_gmute(chat_id): continue try: bot.mute_chat_member(chat_id, user_id) except BadRequest as excp: if excp.message in GMUTE_ERRORS: pass else: message.reply_text("Could not gmute due to: {}".format( excp.message)) send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "Could not gmute due to: {}".format(excp.message)) sql.ungmute_user(user_id) return except TelegramError: pass send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "gmute complete!") message.reply_text("Person has been gmuted.")
def gmute(bot: Bot, update: Update, args: List[str]): message = update.effective_message # type: Optional[Message] user_id, reason = extract_user_and_text(message, args) if not user_id: message.reply_text("You don't seem to be referring to a user.") return if int(user_id) in SUDO_USERS: message.reply_text( "I spy, with my little eye... a sudo user war! Why are you guys turning on each other?" ) return if int(user_id) in SUPPORT_USERS: message.reply_text( "OOOH someone's trying to gmute a support user! *grabs popcorn*") return if user_id == bot.id: message.reply_text( "-_- So funny, lets gmute myself why don't I? Nice try.") return try: user_chat = bot.get_chat(user_id) except BadRequest as excp: message.reply_text(excp.message) return if user_chat.type != 'private': message.reply_text("That's not a user!") return if sql.is_user_gmuted(user_id): if not reason: message.reply_text( "This user is already gmuted; I'd change the reason, but you haven't given me one..." ) return success = sql.update_gmute_reason( user_id, user_chat.username or user_chat.first_name, reason) if success: message.reply_text( "This user is already gmuted; I've gone and updated the gmute reason though!" ) else: message.reply_text( "Do you mind trying again? I thought this person was gmuted, but then they weren't? " "Am very confused") return message.reply_text("*Gets duct tape ready* 😉") muter = update.effective_user # type: Optional[User] send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "{} is gmuting user {} " "because:\n{}".format( mention_html(muter.id, muter.first_name), mention_html(user_chat.id, user_chat.first_name), reason or "No reason given"), html=True) sql.gmute_user(user_id, user_chat.username or user_chat.first_name, reason) chats = get_all_chats() for chat in chats: chat_id = chat.chat_id # Check if this group has disabled gmutes if not sql.does_chat_gmute(chat_id): continue try: bot.restrict_chat_member(chat_id, user_id, can_send_messages=False) except BadRequest as excp: if excp.message == "User is an administrator of the chat": pass elif excp.message == "Chat not found": pass elif excp.message == "Not enough rights to restrict/unrestrict chat member": pass elif excp.message == "User_not_participant": pass elif excp.message == "Peer_id_invalid": # Suspect this happens when a group is suspended by telegram. pass elif excp.message == "Group chat was deactivated": pass elif excp.message == "Need to be inviter of a user to kick it from a basic group": pass elif excp.message == "Chat_admin_required": pass elif excp.message == "Only the creator of a basic group can kick group administrators": pass elif excp.message == "Method is available only for supergroups": pass elif excp.message == "Can't demote chat creator": pass else: message.reply_text("Could not gmute due to: {}".format( excp.message)) send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "Could not gmute due to: {}".format(excp.message)) sql.ungmute_user(user_id) return except TelegramError: pass send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "gmute complete!") message.reply_text("Person has been gmuted.")
def gmute(bot: Bot, update: Update, args: List[str]): message = update.effective_message # type: Optional[Message] user_id, reason = extract_user_and_text(message, args) if not user_id: message.reply_text("Wygląda na to, że nie odnosisz się do futrzaka.") return if int(user_id) in SUDO_USERS: message.reply_text( "Będę go śledził moim małym oczkiem... Wojna sudo futrzaków! Dlaczego odwracacie się od siebie nawzajem?" ) return if int(user_id) in SUPPORT_USERS: message.reply_text( "OHO! któś próbuje globalnie wyciszyć futrzaka od supportu! *bierze popcorn*" ) return if user_id == bot.id: message.reply_text( "-_- Bardzo śmieszne... Globalnie wycisz mnie, dlaczego by nie? Niezła próba." ) return try: user_chat = bot.get_chat(user_id) except BadRequest as excp: message.reply_text(excp.message) return if user_chat.type != 'private': message.reply_text("To nie jest futrzak!") return if sql.is_user_gmuted(user_id): if not reason: message.reply_text( "Ten futrzak jest już globalnie wyciszony. Mogę zmienić powód ale nie podałeś mi żadnego..." ) return success = sql.update_gmute_reason( user_id, user_chat.username or user_chat.first_name, reason) if success: message.reply_text( "Ten futrzak jest już globalnie wyciszony ale nie ma ustawionego powodu. Ale już to zostało poprawione!" ) else: message.reply_text( "Czy możesz spróbować ponownie? Myślałem, że ta osoba była globalnie wyciszona, ale tak nie było? " "Jestem bardzo zdezorientowany") return message.reply_text("*bierze taśmę klejącą* 😉") muter = update.effective_user # type: Optional[User] send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "{} is gmuting user {} " "Ponieważ:\n{}".format( mention_html(muter.id, muter.first_name), mention_html(user_chat.id, user_chat.first_name), reason or "No reason given"), html=True) sql.gmute_user(user_id, user_chat.username or user_chat.first_name, reason) chats = get_all_chats() for chat in chats: chat_id = chat.chat_id # Check if this group has disabled gmutes if not sql.does_chat_gmute(chat_id): continue try: bot.restrict_chat_member(chat_id, user_id, can_send_messages=False) except BadRequest as excp: if excp.message == "Futrzak jest administratorem czatu": pass elif excp.message == "Nie znaleziono czatu": pass elif excp.message == "Brak wystarczających uprawnień do ograniczenia/odgraniczenia futrzaka tego czatu": pass elif excp.message == "User_not_participant": pass elif excp.message == "Peer_id_invalid": # Suspect this happens when a group is suspended by telegram. pass elif excp.message == "Czat grupy został zdeaktywowany": pass elif excp.message == "Trzeba być zapraszającym futrzaka, aby wyciszyć go na grupie": pass elif excp.message == "Chat_admin_required": pass elif excp.message == "Tylko twórca grupy może wyciszać administratorów grupy": pass elif excp.message == "Metoda jest dostępna tylko dla supergrup oraz kanałów": pass elif excp.message == "Nie można zdegradować twórcy czatu": pass else: message.reply_text( "Nie mogę globalnie wyciszyć z powodu: {}".format( excp.message)) send_to_list( bot, SUDO_USERS + SUPPORT_USERS, "Nie mogę globalnie wyciszyć z powodu: {}".format( excp.message)) sql.ungmute_user(user_id) return except TelegramError: pass send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "pomyślnie globalnie wyciszono!") message.reply_text("Futrzak został globalnie wyciszony.")
def gmute(bot: Bot, update: Update, args: List[str]): message = update.effective_message # type: Optional[Message] user_id, reason = extract_user_and_text(message, args) if not user_id: message.reply_text(" .") return if int(user_id) in SUDO_USERS: message.reply_text("I spy, with my little eye... a sudo user war! Why are you guys turning on each other?") return if int(user_id) in SUPPORT_USERS: message.reply_text(" ! * *") return if user_id == bot.id: message.reply_text("-_- Geat Pri .") return try: user_chat = bot.get_chat(user_id) except BadRequest as excp: message.reply_text(excp.message) return if user_chat.type != 'private': message.reply_text(" !") return if sql.is_user_gmuted(user_id): if not reason: message.reply_text(" ...") return success = sql.update_gmute_reason(user_id, user_chat.username or user_chat.first_name, reason) if success: message.reply_text(" !") else: message.reply_text(" " " ") return message.reply_text("* *") muter = update.effective_user # type: Optional[User] send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "{} is gmuting user {} " "because:\n{}".format(mention_html(muter.id, muter.first_name), mention_html(user_chat.id, user_chat.first_name), reason or "No reason given"), html=True) sql.gmute_user(user_id, user_chat.username or user_chat.first_name, reason) chats = get_all_chats() for chat in chats: chat_id = chat.chat_id # Check if this group has disabled gmutes if not sql.does_chat_gmute(chat_id): continue try: bot.restrict_chat_member(chat_id, user_id, can_send_messages=False) except BadRequest as excp: if excp.message == "User is an administrator of the chat": pass elif excp.message == "Chat not found": pass elif excp.message == "Not enough rights to restrict/unrestrict chat member": pass elif excp.message == "User_not_participant": pass elif excp.message == "Peer_id_invalid": # Suspect this happens when a group is suspended by telegram. pass elif excp.message == "Group chat was deactivated": pass elif excp.message == "Need to be inviter of a user to kick it from a basic group": pass elif excp.message == "Chat_admin_required": pass elif excp.message == "Only the creator of a basic group can kick group administrators": pass elif excp.message == "Method is available only for supergroups": pass elif excp.message == "Can't demote chat creator": pass else: message.reply_text(" : {}".format(excp.message)) send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "Could not gmute due to: {}".format(excp.message)) sql.ungmute_user(user_id) return except TelegramError: pass send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "gmute complete!") message.reply_text(" gmputed .")
def gmute(bot: Bot, update: Update, args: List[str]): message = update.effective_message # type: Optional[Message] user_id, reason = extract_user_and_text(message, args) if not user_id: message.reply_text( "നിങ്ങൾ ഒരു യൂസേറിനെ റെഫർ ചെയ്യുന്നതായി തോന്നുന്നില്ല.") return if int(user_id) in SUDO_USERS: message.reply_text( "I spy, with my little eye... a sudo user war! Why are you guys turning on each other?" ) return if int(user_id) in SUPPORT_USERS: message.reply_text( "OOOH someone's trying to gmute a support user! *grabs popcorn*") return if user_id == bot.id: message.reply_text( "-_- ആഹ് നല്ല കോമഡി😂 നിനക്കു ഞാൻ മിണ്ടുന്നത് കൊണ്ടെന്താ കൊഴപ്പം?.") return try: user_chat = bot.get_chat(user_id) except BadRequest as excp: message.reply_text(excp.message) return if user_chat.type != 'private': message.reply_text("അതൊരു യൂസർ അല്ല !") return if sql.is_user_gmuted(user_id): if not reason: message.reply_text( "ഈ യൂസേറിനെ മുന്നേ തന്നെ gmute ചെയ്തതാണ്; ഞാൻ വേണേൽ gmute ചെയ്യാനുള്ള കാരണം മാറ്റാം, പക്ഷേ നിങ്ങൾ ഒരു കാരണവും തന്നിട്ടില്ലല്ലോ..." ) return success = sql.update_gmute_reason( user_id, user_chat.username or user_chat.first_name, reason) if success: message.reply_text( "This user is already gmuted; I've gone and updated the gmute reason though!" ) else: message.reply_text( "Do you mind trying again? I thought this person was gmuted, but then they weren't? " "Am very confused") return message.reply_text("*Gets duct tape ready* 😉") muter = update.effective_user # type: Optional[User] send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "{} is gmuting user {} " "because:\n{}".format( mention_html(muter.id, muter.first_name), mention_html(user_chat.id, user_chat.first_name), reason or "No reason given"), html=True) sql.gmute_user(user_id, user_chat.username or user_chat.first_name, reason) chats = get_all_chats() for chat in chats: chat_id = chat.chat_id # Check if this group has disabled gmutes if not sql.does_chat_gmute(chat_id): continue try: bot.restrict_chat_member(chat_id, user_id, can_send_messages=False) except BadRequest as excp: if excp.message == "User is an administrator of the chat": pass elif excp.message == "Chat not found": pass elif excp.message == "Not enough rights to restrict/unrestrict chat member": pass elif excp.message == "User_not_participant": pass elif excp.message == "Peer_id_invalid": # Suspect this happens when a group is suspended by telegram. pass elif excp.message == "Group chat was deactivated": pass elif excp.message == "Need to be inviter of a user to kick it from a basic group": pass elif excp.message == "Chat_admin_required": pass elif excp.message == "Only the creator of a basic group can kick group administrators": pass elif excp.message == "Method is available only for supergroups": pass elif excp.message == "Can't demote chat creator": pass else: message.reply_text("Could not gmute due to: {}".format( excp.message)) send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "Could not gmute due to: {}".format(excp.message)) sql.ungmute_user(user_id) return except TelegramError: pass send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "gmute complete!") message.reply_text("Person has been gmuted.")
def gmute(bot: Bot, update: Update, args: List[str]): message = update.effective_message # type: Optional[Message] user_id, reason = extract_user_and_text(message, args) if not user_id: message.reply_text("You don't seem to be referring to a user.") return if int(user_id) in SUDO_USERS: message.reply_text( "I spy, with my little eye... a sudo user war! Why are you guys turning on each other?" ) return if int(user_id) in SUPPORT_USERS: message.reply_text( "OOOH someone's trying to gmute a support user! *grabs popcorn*") return if user_id == bot.id: message.reply_text( "-_- So funny, lets gmute myself why don't I? Nice try.") return try: user_chat = bot.get_chat(user_id) except BadRequest as excp: message.reply_text(excp.message) return if user_chat.type != 'private': message.reply_text("That's not a user!") return if sql.is_user_gmuted(user_id): if not reason: message.reply_text( "This user is already gmuted; I'd change the reason, but you haven't given me one..." ) return old_reason = sql.update_gmute_reason( user_id, user_chat.username or user_chat.first_name, reason) user_id, new_reason = extract_user_and_text(message, args) if old_reason: muter = update.effective_user # type: Optional[User] send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "<b>Emendation of Global Mute</b>" \ "\n#GMUTE" \ "\n<b>Status:</b> <code>Amended</code>" \ "\n<b>Sudo Admin:</b> {}" \ "\n<b>User:</b> {}" \ "\n<b>ID:</b> <code>{}</code>" \ "\n<b>Previous Reason:</b> {}" \ "\n<b>Amended Reason:</b> {}".format(mention_html(muter.id, muter.first_name), mention_html(user_chat.id, user_chat.first_name or "Deleted Account"), user_chat.id, old_reason, new_reason), html=True) message.reply_text( "This user is already gmuted, for the following reason:\n" "<code>{}</code>\n" "I've gone and updated it with your new reason!".format( html.escape(old_reason)), parse_mode=ParseMode.HTML) else: muter = update.effective_user # type: Optional[User] send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "<b>Emendation of Global Mute</b>" \ "\n#GMUTE" \ "\n<b>Status:</b> <code>New reason</code>" \ "\n<b>Sudo Admin:</b> {}" \ "\n<b>User:</b> {}" \ "\n<b>ID:</b> <code>{}</code>" \ "\n<b>New Reason:</b> {}".format(mention_html(muter.id, muter.first_name), mention_html(user_chat.id, user_chat.first_name or "Deleted Account"), user_chat.id, new_reason), html=True) message.reply_text( "This user is already gmuted, but had no reason set; I've gone and updated it!" ) return starting = "Initiating global mute for {}...".format( mention_html(user_chat.id, user_chat.first_name or "Deleted Account")) keyboard = [] message.reply_text(starting, reply_markup=keyboard, parse_mode=ParseMode.HTML) muter = update.effective_user # type: Optional[User] send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "<b>Global Mute</b>" \ "\n#GMUTE" \ "\n<b>Status:</b> <code>Enforcing</code>" \ "\n<b>Sudo Admin:</b> {}" \ "\n<b>User:</b> {}" \ "\n<b>ID:</b> <code>{}</code>" \ "\n<b>Reason:</b> {}".format(mention_html(muter.id, muter.first_name), mention_html(user_chat.id, user_chat.first_name or "Deleted Account"), user_chat.id, reason or "No reason given"), html=True) sql.gmute_user(user_id, user_chat.username or user_chat.first_name, reason) chats = get_all_chats() for chat in chats: chat_id = chat.chat_id # Check if this group has disabled gmutes if not sql.does_chat_gmute(chat_id): continue try: bot.restrict_chat_member(chat_id, user_id, can_send_messages=False) except BadRequest as excp: if excp.message == "User is an administrator of the chat": pass elif excp.message == "Chat not found": pass elif excp.message == "Not enough rights to restrict/unrestrict chat member": pass elif excp.message == "User_not_participant": pass elif excp.message == "Peer_id_invalid": # Suspect this happens when a group is suspended by telegram. pass elif excp.message == "Group chat was deactivated": pass elif excp.message == "Need to be inviter of a user to kick it from a basic group": pass elif excp.message == "Chat_admin_required": pass elif excp.message == "Only the creator of a basic group can kick group administrators": pass elif excp.message == "Method is available only for supergroups": pass elif excp.message == "Can't demote chat creator": pass else: message.reply_text("Could not gmute due to: {}".format( excp.message)) send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "Could not gmute due to: {}".format(excp.message)) sql.ungmute_user(user_id) return except TelegramError: pass send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "{} has been successfully gmuted!".format( mention_html(user_chat.id, user_chat.first_name or "Deleted Account")), html=True) message.reply_text("Person has been gmuted.")
def gmute(bot: Bot, update: Update, args: List[str]): message = update.effective_message # type: Optional[Message] user_id, reason = extract_user_and_text(message, args) if not user_id: message.reply_text("ඔබ පරිශීලකයෙකු වෙත යොමු වන බවක් නොපෙනේ.") return if int(user_id) in SUDO_USERS: message.reply_text("මම ඔත්තු බැලුවෙමි, මගේ කුඩා ඇසෙන් ... සුඩෝ පරිශීලක යුද්ධයක්! ඇයි ඔයාලා එකිනෙකාට හරවන්නේ?") return if int(user_id) in SUPPORT_USERS: message.reply_text("OOOH යමෙක් ආධාරක පරිශීලකයෙකු මැඩපැවැත්වීමට උත්සාහ කරයි! *පොප්කෝන් අල්ලා ගනී😎😎*") return if user_id == bot.id: message.reply_text("-_- හරිම විහිලුයි, ඇයි මම නැත්තේ? හොඳයි උත්සාහ කරන්න.") return try: user_chat = bot.get_chat(user_id) except BadRequest as excp: message.reply_text(excp.message) return if user_chat.type != 'private': message.reply_text("That's not a user!") return if sql.is_user_gmuted(user_id): if not reason: message.reply_text("මෙම පරිශීලකයා දැනටමත් gmuted; මම හේතුව වෙනස් කරන්නම්, නමුත් ඔබ මට එකක් දුන්නේ නැහැ ...🥺🥺") return success = sql.update_gmute_reason(user_id, user_chat.username or user_chat.first_name, reason) if success: message.reply_text("මෙම පරිශීලකයා දැනටමත් gmuted; මම ගොස් gmute හේතුව යාවත්කාලීන කර ඇත!") else: message.reply_text("නැවත උත්සාහ කිරීමට ඔබට අවශ්යද? මම හිතුවේ මේ පුද්ගලයා gmuted ඇති, නමුත් පසුව ඔවුන් එසේ නොවේ? " "Am very confused") return message.reply_text("*ඩක් ටේප් සූදානම්* 😉") muter = update.effective_user # type: Optional[User] send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "{} is gmuting user {} " "because:\n{}".format(mention_html(muter.id, muter.first_name), mention_html(user_chat.id, user_chat.first_name), reason or "කිසිදු හේතුවක් දක්වා නැත"), html=True) sql.gmute_user(user_id, user_chat.username or user_chat.first_name, reason) chats = get_all_chats() for chat in chats: chat_id = chat.chat_id # Check if this group has disabled gmutes if not sql.does_chat_gmute(chat_id): continue try: bot.restrict_chat_member(chat_id, user_id, can_send_messages=False) except BadRequest as excp: if excp.message == "පරිශීලකයා චැට් හි පරිපාලකයෙකි": pass elif excp.message == "චැට් හමු නොවීය": pass elif excp.message == "චැට් සාමාජිකයාව සීමා කිරීමට / සීමා කිරීමට ප්රමාණවත් අයිතිවාසිකම් නොමැත": pass elif excp.message == "සහභාගිවන්නා_භාවිතා_කරන්න": pass elif excp.message == "Peer_id_invalid": # Suspect this happens when a group is suspended by telegram. pass elif excp.message == "කණ්ඩායම් කතාබහ අක්රිය කරන ලදි": pass elif excp.message == "මූලික කණ්ඩායමකින් එය පයින් ගැසීමට පරිශීලකයෙකුගේ ආරාධිතයා විය යුතුය": pass elif excp.message == "චැට්_පරිපාලක_අවශ්යයි": pass elif excp.message == "කණ්ඩායම් පරිපාලකයින්ට kick ගැසිය හැක්කේ මූලික කණ්ඩායමක නිර්මාතෘට පමණි": pass elif excp.message == "ක්රමය ලබා ගත හැක්කේ සුපිරි කණ්ඩායම් සඳහා පමණි": pass elif excp.message == "චැට් නිර්මාතෘ පහත් කළ නොහැක": pass else: message.reply_text("නිසා gmute කිරීමට නොහැකි විය: {}".format(excp.message)) send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "නිසා gmute කිරීමට නොහැකි විය: {}".format(excp.message)) sql.ungmute_user(user_id) return except TelegramError: pass send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "gmute complete!") message.reply_text("පුද්ගලයා gmute කර ඇත.")
def gmute(bot: Bot, update: Update, args: List[str]): message = update.effective_message # type: Optional[Message] user_id, reason = extract_user_and_text(message, args) if not user_id: message.reply_text("Bir istifadəçiyə istinad etmirsiniz.") return if int(user_id) in SUDO_USERS: message.reply_text("Mən öz balaca gözlərim ilə ağlayıram... bir sudo istifadəçi müharibəsi! Siz niyə bir birinizə bumu edirsiniz?") return if int(user_id) in SUPPORT_USERS: message.reply_text("OOOH! kimsə bir suppport isitfadəçisini global olaraq susdurmaq istəyir *popcorn alıb izləyirəm*") return if user_id == bot.id: message.reply_text("-_- Çox əyləncəlidir, gəl özümü qlobal olaaq susdurum? Gözəl cəhd.") return try: user_chat = bot.get_chat(user_id) except BadRequest as excp: message.reply_text(excp.message) return if user_chat.type != 'private': message.reply_text("Bu bir istifadəçi deyil!") return if sql.is_user_gmuted(user_id): if not reason: message.reply_text("Bu istifadəçi onsuz da qlobal olaraq susdurulub; Səbəbi dəyişərdim amma bir səbəb verməmisən...") return success = sql.update_gmute_reason(user_id, user_chat.username or user_chat.first_name, reason) if success: message.reply_text("Bu istifadəçi onsuz da qlobal olaraq susdurulub; Köhnə səbəbi yenisi ilə əvəz etdim!") else: message.reply_text("Yenidən cəhd etməyi düşünmürsən? Bu adamın qlobal olaraq susdurulduğunu düşünürdüm, amma sonra deyildilər? " "Çox qarışıqam") return message.reply_text("Yapışqan lenti hazır vəziyyətə gətirdim 😉") muter = update.effective_user # type: Optional[User] send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "{} {} istifadəçisini qlobal olaraq susdurur " "çünki:\n{}".format(mention_html(muter.id, muter.first_name), mention_html(user_chat.id, user_chat.first_name), reason or "Səbəb verilməyib"), html=True) sql.gmute_user(user_id, user_chat.username or user_chat.first_name, reason) chats = get_all_chats() for chat in chats: chat_id = chat.chat_id # Check if this group has disabled gmutes if not sql.does_chat_gmute(chat_id): continue try: bot.restrict_chat_member(chat_id, user_id, can_send_messages=False) except BadRequest as excp: if excp.message == "User is an administrator of the chat": pass elif excp.message == "Chat not found": pass elif excp.message == "Not enough rights to restrict/unrestrict chat member": pass elif excp.message == "User_not_participant": pass elif excp.message == "Peer_id_invalid": # Suspect this happens when a group is suspended by telegram. pass elif excp.message == "Group chat was deactivated": pass elif excp.message == "Need to be inviter of a user to kick it from a basic group": pass elif excp.message == "Chat_admin_required": pass elif excp.message == "Only the creator of a basic group can kick group administrators": pass elif excp.message == "Method is available only for supergroups": pass elif excp.message == "Can't demote chat creator": pass else: message.reply_text("Could not gmute due to: {}".format(excp.message)) send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "Could not gmute due to: {}".format(excp.message)) sql.ungmute_user(user_id) return except TelegramError: pass send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "gmute tamamlandı!") message.reply_text("İstifadəçi qlobal olaraq susduruldu.")
return success = sql.update_gmute_reason(user_id, user_chat.username or user_chat.first_name, reason) if success: message.reply_text("This user is already gmuted; I've gone and updated the gmute reason though!") else: message.reply_text("Do you mind trying again? I thought this person was gmuted, but then they weren't? " "Am very confused") return message.reply_text("*Gets duct tape ready* 😉") muter = update.effective_user # type: Optional[User] send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "{} is gmuting user {} " "because:\n{}".format(mention_html(muter.id, muter.first_name), mention_html(user_chat.id, user_chat.first_name), reason or "No reason given"), html=True) sql.gmute_user(user_id, user_chat.username or user_chat.first_name, reason) chats = get_all_chats() for chat in chats: chat_id = chat.chat_id # Check if this group has disabled gmutes if not sql.does_chat_gmute(chat_id): continue try: bot.restrict_chat_member(chat_id, user_id, can_send_messages=False) except BadRequest as excp: if excp.message == "User is an administrator of the chat": pass elif excp.message == "Chat not found": pass elif excp.message == "Not enough rights to restrict/unrestrict chat member": pass
def gmute(bot: Bot, update: Update, args: List[str]): message = update.effective_message # type: Optional[Message] user_id, reason = extract_user_and_text(message, args) if not user_id: message.reply_text("Deyəsən bir istifadəçiyə istinad etmirsiniz.") return if int(user_id) in SUDO_USERS: message.reply_text( "Mən kiçik gözümlə casusluq edirəm ... sudo istifadəçiləri müharibəsi! Uşaqlar niyə bir-birinizlə dalaşırsız?" ) return if int(user_id) in SUPPORT_USERS: message.reply_text( "AHAHAH Kimsə Support İstifadəçini Qlobal Mute etmək istiyir *popcorn gətirim gəlirəm*" ) return if user_id == bot.id: message.reply_text("Çox gülməli idi birdə yoxla.") return try: user_chat = bot.get_chat(user_id) except BadRequest as excp: message.reply_text(excp.message) return if user_chat.type != 'private': message.reply_text("Bu istifadəçi deyil!") return if sql.is_user_gmuted(user_id): if not reason: message.reply_text( "Bu istifadəçi artıq səssizləşdirilib səbəb bildirilməyib") return success = sql.update_gmute_reason( user_id, user_chat.username or user_chat.first_name, reason) if success: message.reply_text("İstifadəçisi onsuz da səssizdir!") else: message.reply_text("İstifadəçisi onsuz da səssizdir! " "Başım çox qarışdı") return message.reply_text("*Hazırlaşın qlobal mute gəlir* 😉") muter = update.effective_user # type: Optional[User] send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "{} adlı istifadəçi {}-ni susturdu " "Səbəb:\n{}".format( mention_html(muter.id, muter.first_name), mention_html(user_chat.id, user_chat.first_name), reason or "No reason given"), html=True) sql.gmute_user(user_id, user_chat.username or user_chat.first_name, reason) chats = get_all_chats() for chat in chats: chat_id = chat.chat_id # Check if this group has disabled gmutes if not sql.does_chat_gmute(chat_id): continue try: bot.restrict_chat_member(chat_id, user_id, can_send_messages=False) except BadRequest as excp: if excp.message == "User is an administrator of the chat": pass elif excp.message == "Chat not found": pass elif excp.message == "Not enough rights to restrict/unrestrict chat member": pass elif excp.message == "User_not_participant": pass elif excp.message == "Peer_id_invalid": # Suspect this happens when a group is suspended by telegram. pass elif excp.message == "Group chat was deactivated": pass elif excp.message == "Need to be inviter of a user to kick it from a basic group": pass elif excp.message == "Chat_admin_required": pass elif excp.message == "Only the creator of a basic group can kick group administrators": pass elif excp.message == "Method is available only for supergroups": pass elif excp.message == "Can't demote chat creator": pass else: message.reply_text("Could not gmute due to: {}".format( excp.message)) send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "Could not gmute due to: {}".format(excp.message)) sql.ungmute_user(user_id) return except TelegramError: pass send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "Əməliyyatlar bitdi") message.reply_text("İstifadəçi qlobalda susturldu.")
def gmute(bot: Bot, update: Update, args: List[str]): message = update.effective_message # type: Optional[Message] user_id, reason = extract_user_and_text(message, args) if not user_id: message.reply_text("Gelecek sefer birisini hedef almaya çalış.") return if int(user_id) in SUDO_USERS: message.reply_text("Sakin ol adamım, böyle bir şey olmayacak!") return if int(user_id) in SUPPORT_USERS: message.reply_text( "OOOH Birisi destek kullanıcımı gmutelemeye çalışıyor.") return if user_id == bot.id: message.reply_text( "-_- Çok eğlenceli. Kendimi küresel olarak susturmalıyım, neden olmasın? Güzel deneme." ) return try: user_chat = bot.get_chat(user_id) except BadRequest as excp: message.reply_text(excp.message) return if user_chat.type != 'private': message.reply_text("Bu bir kullanıcı değil!") return if sql.is_user_gmuted(user_id): if not reason: message.reply_text( "Bu kullanıcı zaten gmuteli; Sebebini değiştirebilirdim ama, ama bana sebep vermedin..." ) return success = sql.update_gmute_reason( user_id, user_chat.username or user_chat.first_name, reason) if success: message.reply_text( "Bu kullanıcı zaten gmuteli. Sebebini gittim ve güncelledim!") else: message.reply_text( "Yeniden düşünmeme izin ver. Bu kullanıcı zaten gmuteliydi. Yoksa değilmiydi? " "Kafam karıştı") return message.reply_text("Kapa çeneni 🤐") muter = update.effective_user # type: Optional[User] send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "<b>Global Mute</b>" \ "\n#GMUTE" \ "\n<b>Durum:</b> <code>Etkin</code>" \ "\n<b>Sudo Admin:</b> {}" \ "\n<b>Kullanıcı:</b> {}" \ "\n<b>ID:</b> <code>{}</code>" \ "\n<b>Sebep:</b> {}".format(mention_html(muter.id, muter.first_name), mention_html(user_chat.id, user_chat.first_name), user_chat.id, reason or "Sebep belirtmedi"), html=True) sql.gmute_user(user_id, user_chat.username or user_chat.first_name, reason) chats = get_all_chats() for chat in chats: chat_id = chat.chat_id # Check if this group has disabled gmutes if not sql.does_chat_gmute(chat_id): continue try: bot.restrict_chat_member(chat_id, user_id, can_send_messages=False) except BadRequest as excp: if excp.message == "User is an administrator of the chat": pass elif excp.message == "Chat not found": pass elif excp.message == "Not enough rights to restrict/unrestrict chat member": pass elif excp.message == "User_not_participant": pass elif excp.message == "Peer_id_invalid": # Suspect this happens when a group is suspended by telegram. pass elif excp.message == "Group chat was deactivated": pass elif excp.message == "Need to be inviter of a user to kick it from a basic group": pass elif excp.message == "Chat_admin_required": pass elif excp.message == "Only the creator of a basic group can kick group administrators": pass elif excp.message == "Method is available only for supergroups": pass elif excp.message == "Can't demote chat creator": pass else: message.reply_text( "Şu sebepten dolayı gmuteleyemedim: {}".format( excp.message)) send_to_list( bot, SUDO_USERS + SUPPORT_USERS, "Şu sebepten dolayı gmuteleyemedim: {}".format( excp.message)) sql.ungmute_user(user_id) return except TelegramError: pass send_to_list(bot, SUDO_USERS + SUPPORT_USERS, "{} Küresel olarak susturuldu!".format( mention_html(user_chat.id, user_chat.first_name)), html=True) message.reply_text("Yakın bir zamanda bir daha konuşamayacaksın.")