def unlock(bot, update, args): chat = update.effective_chat message = update.effective_message if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("Unlocked {} for everyone!".format(args[0])) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) message.reply_text("Unlocked {} for everyone!".format(args[0])) else: message.reply_text("What are you trying to unlock...? Try /locktypes for the list of lockables") else: bot.sendMessage(chat.id, "What are you trying to unlock...?")
def lock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if can_delete(chat, bot.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=True) message.reply_text("Bloccati i messaggi che contengono {} per tutti i non admin!".format(args[0])) return "<b>{}:</b>" \ "\n#LOCK" \ "\n<b>Admin:</b> {}" \ "\nBloccato <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=True) if args[0] == "previews": members = users_sql.get_chat_members(str(chat.id)) restr_members(bot, chat.id, members, messages=True, media=True, other=True) message.reply_text("Bloccati i {} per tutti i non admin!".format(args[0])) return "<b>{}:</b>" \ "\n#LOCK" \ "\n<b>Admin:</b> {}" \ "\nBloccato <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text("Cosa stai cercando ti bloccare...? Usa /locktypes per la lista degli elementi bloccabili.") else: message.reply_text("Non sono un amministratore oppure non ho i permessi di cancellazione.") return ""
def lock(bot, update, args): chat = update.effective_chat message = update.effective_message if can_delete(chat, bot.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=True) message.reply_text("Locked {} messages for all non-admins!".format(args[0])) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=True) members = users_sql.get_chat_members(chat.id) if args[0] == "messages": restr_members(bot, chat.id, members) elif args[0] == "media": restr_members(bot, chat.id, members, messages=True) elif args[0] == "other": restr_members(bot, chat.id, members, messages=True, media=True) elif args[0] == "previews": restr_members(bot, chat.id, members, messages=True, media=True, other=True) elif args[0] == "all": restr_members(bot, chat.id, members) message.reply_text("Locked {} for all non-admins!".format(args[0])) else: message.reply_text("What are you trying to lock...? Try /locktypes for the list of lockables") else: message.reply_text("I'm not an administrator, or haven't got delete rights.")
def unlock(update: Update, context: CallbackContext) -> str: if not check_perms(update, 1): return bot, args = context.bot, context.args chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("Unlocked {} for everyone!".format(args[0])) return ("<b>{}:</b>" "\n#UNLOCK" "\n<b>Admin:</b> {}" "\nUnlocked <code>{}</code>.".format( html.escape(chat.title), mention_html(user.id, user.first_name), args[0], )) if args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text("Unlocked {} for everyone!".format(args[0])) return ("<b>{}:</b>" "\n#UNLOCK" "\n<b>Admin:</b> {}" "\nUnlocked <code>{}</code>.".format( html.escape(chat.title), mention_html(user.id, user.first_name), args[0], )) message.reply_text( "What are you trying to unlock...? Try /locktypes for the list of lockables" ) else: bot.sendMessage(chat.id, "What are you trying to unlock...?") return ""
def __import_data__(chat_id, data): # set chat locks locks = data.get("locks", {}) for itemlock in locks: if itemlock in LOCK_TYPES: sql.update_lock(chat_id, itemlock, locked=True) elif itemlock in LOCK_CHAT_RESTRICTION: sql.update_restriction(chat_id, itemlock, locked=True)
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text( "Sbloccati i messaggi che contengono {} per tutti!".format( args[0])) return ("<b>{}:</b>" "\n#UNLOCK" "\n<b>Admin:</b> {}" "\nSbloccato <code>{}</code>.".format( html.escape(chat.title), mention_html(user.id, user.first_name), args[0], )) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text("Unlocked {} for everyone!".format(args[0])) return ("<b>{}:</b>" "\n#UNLOCK" "\n<b>Admin:</b> {}" "\nSbloccato <code>{}</code>.".format( html.escape(chat.title), mention_html(user.id, user.first_name), args[0], )) else: message.reply_text( "Cosa stai cercando ti sbloccare...? Usa /locktypes per la lista degli elementi bloccabili." ) else: bot.sendMessage(chat.id, "Cosa stai cercando ti sbloccare...?") return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("Unlocked {} for everyone!".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text("Unlocked {} for everyone!".format(args[0])) message.reply_text( "NOTE: due to a recent abuse of locking, {} will now only be deleting messages, and not " "restricting users via the tg api. This shouldn't affect all you users though, so dont worry! " "Just means that any restricted users should be manually unrestricted from the chat " "admin pannel.".format(bot.first_name)) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text( "What are you trying to unlock...? Try /locktypes for the list of lockables" ) else: bot.sendMessage(chat.id, "What are you trying to unlock...?") return ""
def lock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat user = update.effective_user message = update.effective_message if can_delete(chat, bot.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=True) message.reply_text( "Locked {} messages for all non-admins!".format(args[0])) return "<b>{}:</b>" \ "\n#LOCK" \ "\n<b>Admin:</b> {}" \ "\nLocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=True) """ if args[0] == "messages": chat.set_permissions(can_send_messages=False) elif args[0] == "media": chat.set_permissions(can_send_media_messages=False) elif args[0] == "other": chat.set_permissions(can_send_other_messages=False) elif args[0] == "previews": chat.set_permissions(can_add_web_page_previews=False) elif args[0] == "all": chat.set_permissions(can_send_messages=False) """ message.reply_text("Locked {} for all non-admins!".format( args[0])) return "<b>{}:</b>" \ "\n#LOCK" \ "\n<b>Admin:</b> {}" \ "\nLocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text( "What are you trying to lock...? Try /locktypes for the list of lockables" ) else: message.reply_text( "I'm not an administrator, or haven't got delete rights.") return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("{} funksiyası kilidi açıldı!".format( args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text("{} funksiyası Kilidi qaldırıldı!".format( args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text( "Nəyi kilitləməyə çalışdığına əmin ola bilmədim... /locktypes yazaraq qapatmaq istədiyin funksiyanın bu siyahıda olub olmadığını yoxla." ) else: bot.sendMessage( chat.id, "Kilidini açacağın funksiya barədə heç bir məlumat tapılmadı..." ) return ""
def lock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat user = update.effective_user message = update.effective_message if can_delete(chat, bot.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=True) message.reply_text( "Pesan {} terkunci untuk semua non-admin!".format(args[0]) ) return ( f"<b>{html.escape(chat.title)}:</b>\n" f"#LOCK\n" f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n" f"Terkunci <code>{args[0]}</code>." ) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=True) """ if args[0] == "messages": chat.set_permissions(can_send_messages=False) elif args[0] == "media": chat.set_permissions(can_send_media_messages=False) elif args[0] == "other": chat.set_permissions(can_send_other_messages=False) elif args[0] == "previews": chat.set_permissions(can_add_web_page_previews=False) elif args[0] == "all": chat.set_permissions(can_send_messages=False) """ message.reply_text("Locked {} for all non-admins!".format(args[0])) return ( f"<b>{html.escape(chat.title)}:</b>\n" f"#LOCK\n" f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n" f"Locked <code>{args[0]}</code>." ) else: message.reply_text( "Apa yang kamu coba kunci ...? Coba /locktypes untuk daftar yang dapat dikunci" ) else: message.reply_text("Saya bukan administrator, atau tidak punya hak hapus.") return ""
def lock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if can_delete(chat, bot.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=True) message.reply_text( tld(chat.id, "Locked {} messages for all non-admins!").format( args[0])) return "<b>{}:</b>" \ "\n#LOCK" \ "\n<b>Admin:</b> {}" \ "\nLocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=True) if args[0] == "previews": members = users_sql.get_chat_members(str(chat.id)) restr_members(bot, chat.id, members, messages=True, media=True, other=True) message.reply_text( tld(chat.id, "Locked {} for all non-admins!").format(args[0])) return "<b>{}:</b>" \ "\n#LOCK" \ "\n<b>Admin:</b> {}" \ "\nLocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text( tld( chat.id, "What are you trying to lock...? Try /locktypes for the list of lockables" )) else: message.reply_text( tld( chat.id, "Make sure I'm an administrator and have permission to delete messages, then try again." )) return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text( "Nimefungua {} Sasa kila mtu anaweza kutuma hapa..".format( args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text( "Nimefungua {} Sasa kila mtu anaweza kutuma hapa..".format( args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text( "What are you trying to unlock...? Try /locktypes for the list of lockables" ) else: bot.sendMessage(chat.id, "What are you trying to unlock...?") return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] admin = chat.get_member(int(user.id)) if ( admin.status != 'creator' ) and ( not admin.can_restrict_members ) and ( not int(user.id) in SUDO_USERS ): update.effective_message.reply_text("You don't have sufficient permissions to restrict users!") return "" if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("Unlocked {} for everyone!".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text("Unlocked {} for everyone!".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text("What are you trying to unlock...? Try /locktypes for the list of lockables") else: bot.sendMessage(chat.id, "What are you trying to unlock...?") return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat user = update.effective_user message = update.effective_message if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text(f"Unlocked {args[0]} for everyone!") return ( f"<b>{html.escape(chat.title)}:</b>\n" f"#UNLOCK\n" f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n" f"Unlocked <code>{args[0]}</code>." ) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ #members = users_sql.get_chat_members(chat.id) if args[0] == "messages": chat.set_permissions(can_send_messages=True) elif args[0] == "media": chat.set_permissions(can_send_media_messages=True) elif args[0] == "other": chat.set_permissions(can_send_other_messages=True) elif args[0] == "previews": chat.set_permissions(can_add_web_page_previews=True) elif args[0] == "all": chat.set_permissions(can_send_messages=True, can_send_media_messages=True, can_send_other_messages=True, can_add_web_page_previews=True, can_send_polls=True) """ message.reply_text("Unlocked {} for everyone!".format(args[0])) return ( f"<b>{html.escape(chat.title)}:</b>\n" f"#UNLOCK\n" f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n" f"Unlocked <code>{args[0]}</code>." ) else: message.reply_text( "What are you trying to unlock...? Try /locktypes for the list of lockables" ) else: bot.sendMessage(chat.id, "What are you trying to unlock...?") return ""
def lock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] admin = chat.get_member(int(user.id)) if ( admin.status != 'creator' ) and ( not admin.can_restrict_members ) and ( not int(user.id) in SUDO_USERS ): update.effective_message.reply_text("You don't have sufficient permissions to restrict users!") return "" if can_delete(chat, bot.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=True) message.reply_text("Locked {} messages for all non-admins!".format(args[0])) return "<b>{}:</b>" \ "\n#LOCK" \ "\n<b>Admin:</b> {}" \ "\nLocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=True) if args[0] == "previews": members = users_sql.get_chat_members(str(chat.id)) restr_members(bot, chat.id, members, messages=True, media=True, other=True) bot.restrict_chat_member(chat.id, int(777000), can_send_messages=True, can_send_media_messages=True, can_send_other_messages=True, can_add_web_page_previews=True) bot.restrict_chat_member(chat.id, int(1087968824), can_send_messages=True, can_send_media_messages=True, can_send_other_messages=True, can_add_web_page_previews=True) message.reply_text("Locked {} for all non-admins!".format(args[0])) return "<b>{}:</b>" \ "\n#LOCK" \ "\n<b>Admin:</b> {}" \ "\nLocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text("What are you trying to lock...? Try /locktypes for the list of lockables") else: message.reply_text("I'm not an administrator, or haven't got delete rights.") return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat user = update.effective_user message = update.effective_message if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text(f"Unlocked {args[0]} for everyone!") return ( f"<b>{html.escape(chat.title)}:</b>\n" f"#UNLOCK\n" f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n" f"Tidak terkunci <code>{args[0]}</code>." ) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ #members = users_sql.get_chat_members(chat.id) if args[0] == "messages": chat.set_permissions(can_send_messages=True) elif args[0] == "media": chat.set_permissions(can_send_media_messages=True) elif args[0] == "other": chat.set_permissions(can_send_other_messages=True) elif args[0] == "previews": chat.set_permissions(can_add_web_page_previews=True) elif args[0] == "all": chat.set_permissions(can_send_messages=True, can_send_media_messages=True, can_send_other_messages=True, can_add_web_page_previews=True, can_send_polls=True) """ message.reply_text("Terbuka {} untuk semua orang!".format(args[0])) return ( f"<b>{html.escape(chat.title)}:</b>\n" f"#UNLOCK\n" f"<b>Admin:</b> {mention_html(user.id, user.first_name)}\n" f"Unlocked <code>{args[0]}</code>." ) else: message.reply_text( "Apa yang Anda coba buka kuncinya ...? Coba /locktypes untuk daftar yang dapat dikunci" ) else: bot.sendMessage(chat.id, "Apa yang Anda coba buka kuncinya...?") return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text( " {} सभी नॉन एडमिन्स के लिए खोल दिया गया!".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text( " {} सभी नॉन एडमिन्स के लिए खोल दिया गया!".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text( "क्या बंद करने की कोशिश कर रहे हैं ...? लॉकबल की सूची के लिए /locktypes कोशिश करें" ) else: bot.sendMessage(chat.id, "क्या आप अनलॉक करने की कोशिश कर रहे हैं...?") return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: args[0] = donustur(args[0]) if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("Herkes için {} kilidi açıldı!".format( args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Yönetici:</b> {}" \ "\nkilidi kaldırdı <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text("Herkes için {} kilidi açıldı!".format( args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Yönetici:</b> {}" \ "\nkilidi kaldırdı <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text( "Neyin kilidini açmaya çalışıyorsun..? /kilittipi yazarak tüm seçenekleri görebilirsin." ) else: bot.sendMessage(chat.id, "Neyin kilidini açmaya çalışıyorsun...?") return ""
def unlock(bot: Bot, update: Update, context: CallbackContext) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] args = context.args if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("모두에게 {} 락 해제!".format(args[0])) return "<b>{}:</b>" \ "\n#언락" \ "\n<b>관리자:</b> {}" \ "\n언락 <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(context.bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(context.bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(context.bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(context.bot, chat.id, members) elif args[0] == "all": unrestr_members(context.bot, chat.id, members, True, True, True, True) """ message.reply_text("Unlocked {} for everyone!".format(args[0])) return "<b>{}:</b>" \ "\n#언락" \ "\n<b>관리자:</b> {}" \ "\n잠금해제된 메시지: <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text( "무엇의 잠금을 해제하시려는 건가요...? 잠금 목록을 보기 위해 /locktypes 를 입력하세요") else: context.bot.sendMessage(chat.id, "무엇의 잠금을 해제하시려는 건가요...?") return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("{} ها برای همه باز شد!".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text("قفل {} برداشته شد!!".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text( "چیو میخوای قفل کنی متوجه نمیشم ! از دستور /locktypes برای قفل های موجور استفاده کن!" ) else: bot.sendMessage(chat.id, "چیو میخوای باز کنی ؟ ") return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("غير مقفلة {} للجميع!".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text("Unlocked {} for everyone!".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text( "ما الذي تحاول فتح ...؟ حاول / locktypes لقائمة القفل") else: bot.sendMessage(chat.id, "ما الذي تحاول فتحة...؟ هذا للأدمن فقط") return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("Unlocked {} for everyone!".format(args[0])) return "{}:" \ "\n#UNLOCK" \ "\n*Admin:* [{}](tg://user?id={})" \ "\nUnlocked `{}`.".format(escape_markdown(chat.title), escape_markdown(user.first_name), user.id, args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) message.reply_text("Unlocked {} for everyone!".format(args[0])) return "{}:" \ "\n#UNLOCK" \ "\n*Admin:* [{}](tg://user?id={})" \ "\nUnlocked `{}`.".format(escape_markdown(chat.title), escape_markdown(user.first_name), user.id, args[0]) else: message.reply_text("What are you trying to unlock...? Try /locktypes for the list of lockables") else: bot.sendMessage(chat.id, "What are you trying to unlock...?") return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("Unlocked 😏 Iny aarkkuvenelum {} ayakkaam. 😒 ".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text("Unlocked 😏 Iny aarkkuvenelum {} ayakkaam. 😒 ".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text("Enthaada unlock cheyyendath? /locktypes nokkittu para ") else: bot.sendMessage(chat.id, "Enthaada unlock cheyyendath vegam para. 😕") return ""
def lock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if can_delete(chat, bot.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=True) message.reply_text( "Locked {} messages for all non-admins!".format( args[0])) # LOCK_SUCCESS return "<b>{}:</b>" \ "\n#LOCK" \ "\n<b>Admin:</b> {}" \ "\nLocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) # LOCK_SUCCESS_HTML elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=True) if args[0] == "previews": members = users_sql.get_chat_members(str(chat.id)) restr_members(bot, chat.id, members, messages=True, media=True, other=True) message.reply_text("Locked {} for all non-admins!".format( args[0])) # LOCK_SUCCESS_2 return "<b>{}:</b>" \ "\n#LOCK" \ "\n<b>Admin:</b> {}" \ "\nLocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) # LOCK_SUCCESS_HTML else: message.reply_text( "What are you trying to lock...? Try /locktypes for the list of lockables" ) # ERR_NO_ARGS else: message.reply_text( "I'm not an administrator, or haven't got delete rights." ) # ERR_NO_PERMS return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("Odblokowano {} dla wszystkich futrzaków!".format(args[0])) return "<b>{}:</b>" \ "\n#ODBLOKOWANIE" \ "\n<b>Administrator:</b> {}" \ "\nOdblokowano <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text("Unlocked {} for everyone!".format(args[0])) return "<b>{}:</b>" \ "\n#ODBLOKOWANIE" \ "\n<b>Administrator:</b> {}" \ "\nOdblokowano <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text("Co ty chcesz odblokować...? Sprawdź listę możliwych blokad poprzez /locktypes") else: bot.sendMessage(chat.id, "Co ty chcesz odblokować...?") return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("Unlocked {} for everyone!".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text("අගුළු හරින ලදි {} සියල්ලන්ම සඳහා!".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text("ඔබ අගුළු ඇරීමට උත්සාහ කරන්නේ කුමක්ද ...? ලොකබල් ලැයිස්තුව සඳහා / ලොක් ටයිප් උත්සාහ කරන්න") else: bot.sendMessage(chat.id, "ඔබ අගුළු ඇරීමට උත්සාහ කරන්නේ කුමක්ද ...?") return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("{} kilidi açıldı!".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text("{} Kilidi açıldı!".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text("Nəyin kilidi açmağa çalışırsan...? /locktypes kilidlənə bilən şey şüylərə baxa bilərsən") else: bot.sendMessage(chat.id, "Nəyin kilidini açmağa çalışırsan...?") return ""
def lock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if can_delete(chat, bot.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=True) message.reply_text( "Nilifunga {} Hakuna kutuma tena kwa zisizo-admin Haiwezekani.!" .format(args[0])) return "<b>{}:</b>" \ "\n#LOCK" \ "\n<b>Admin:</b> {}" \ "\nLocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=True) if args[0] == "previews": members = users_sql.get_chat_members(str(chat.id)) restr_members(bot, chat.id, members, messages=True, media=True, other=True) message.reply_text( "Nilifunga {} Hakuna kutuma tena kwa zisizo-admin Haiwezekani.!" .format(args[0])) return "<b>{}:</b>" \ "\n#LOCK" \ "\n<b>Admin:</b> {}" \ "\nLocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text( "Je! Unajaribu kufunga nini...? /locktypes Tafuta aina ya kufuli na utumie.." ) else: message.reply_text( "Mimi sio msimamizi, wala sipewi mipaka ya kufunga.") return ""
def lock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if can_delete(chat, bot.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=True) message.reply_text("{} qeyd olunan funksiya bağlandı!".format( args[0])) return "<b>{}:</b>" \ "\n#LOCK" \ "\n<b>Admin:</b> {}" \ "\nLocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=True) if args[0] == "previews": members = users_sql.get_chat_members(str(chat.id)) restr_members(bot, chat.id, members, messages=True, media=True, other=True) message.reply_text( "{} funksiyası bütün istifadəçilər üçün qapandı.".format( args[0])) return "<b>{}:</b>" \ "\n#LOCK" \ "\n<b>Admin:</b> {}" \ "\nLocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text( "Nəyi kilitləməyə çalışdığına əmin ola bilmədim... /locktypes yazaraq qapatmaq istədiyin funksiyanın bu siyahıda olub olmadığını yoxla." ) else: message.reply_text( "Mən ya admin deyiləm yada mesaj silmə özəlliyimi bağlamısan 😏") return ""
def unlock(bot: Bot, update: Update, args: List[str]) -> str: chat = update.effective_chat # type: Optional[Chat] user = update.effective_user # type: Optional[User] message = update.effective_message # type: Optional[Message] if is_user_admin(chat, message.from_user.id): if len(args) >= 1: if args[0] in LOCK_TYPES: sql.update_lock(chat.id, args[0], locked=False) message.reply_text("Herkes için kilidi açık {}!".format( args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) elif args[0] in RESTRICTION_TYPES: sql.update_restriction(chat.id, args[0], locked=False) """ members = users_sql.get_chat_members(chat.id) if args[0] == "messages": unrestr_members(bot, chat.id, members, media=False, other=False, previews=False) elif args[0] == "media": unrestr_members(bot, chat.id, members, other=False, previews=False) elif args[0] == "other": unrestr_members(bot, chat.id, members, previews=False) elif args[0] == "previews": unrestr_members(bot, chat.id, members) elif args[0] == "all": unrestr_members(bot, chat.id, members, True, True, True, True) """ message.reply_text("Unlocked {} for everyone!".format(args[0])) return "<b>{}:</b>" \ "\n#UNLOCK" \ "\n<b>Admin:</b> {}" \ "\nUnlocked <code>{}</code>.".format(html.escape(chat.title), mention_html(user.id, user.first_name), args[0]) else: message.reply_text( "Neyi çözmeye çalışıyorsun...? Kilitlenebilirler listesi için /locktypes deneyin" ) else: bot.sendMessage(chat.id, "Neyi çözmeye çalışıyorsun?..?") return ""