Beispiel #1
0
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]))

                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("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 ""
Beispiel #2
0
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("تمام {} برای افراد عادی قفل شد!".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("تمام {} برای افراد عادی قفل شد!".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(
                    "چیو میخوای قفل کنی متوجه نمیشم ! از دستور /locktypes برای قفل های موجور استفاده کن!"
                )

    else:
        message.reply_text(
            "اومم من هنوز ادمین نیستم ! شایدم اجازه قفل برام فعال نیس")

    return ""
Beispiel #3
0
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(
                    "Yönetici olmayan tüm iletiler için kilitli {} iletileri!".
                    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(
                    "Tüm yönetici olmayanlar için kilitli {}!".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(
                    "Neyi kilitlemeye çalışıyorsun?..? Try /locktypes for the list of lockables"
                )

    else:
        message.reply_text("Yönetici değilim veya silme haklarım yok.")

    return ""
Beispiel #4
0
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("/locktypes for the list of lockables")

        else:
            bot.sendMessage(chat.id, "What are you trying to unlock?")
Beispiel #5
0
def lock(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 can_delete(chat, context.bot.id):
        if len(args) >= 1:
            if args[0] in LOCK_TYPES:
                sql.update_lock(chat.id, args[0], locked=True)
                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=True)
                if args[0] == "previews":
                    members = users_sql.get_chat_members(str(chat.id))
                    restr_members(context.bot,
                                  chat.id,
                                  members,
                                  messages=True,
                                  media=True,
                                  other=True)

                message.reply_text("Locked {} for all non-admins!".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:
        message.reply_text("제가 관리자가 아니거나 메시지를 삭제할 권한이 없어요...")

    return ""
Beispiel #6
0
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(
                    " {} सभी नॉन एडमिन्स के लिए बंद कर दिया!".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(
                    " {} सभी नॉन एडमिन्स के लिए बंद कर दिया !".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(
                    "क्या बंद करने की कोशिश कर रहे हैं ...? लॉकबल की सूची के लिए /locktypes कोशिश करें"
                )

    else:
        message.reply_text("मैं एडमिन नहीं हूं, या राइट्स नहीं नहीं हैं,.")

    return ""
Beispiel #7
0
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("مقفل {} رسائل لجميع غير مدرجين!".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("مغلق {} لجميع غير مدرجين!".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(
                    "ماذا تحاول قفل ...؟ حاول / locktyes لقائمة القفل")

    else:
        message.reply_text("أنا لست مسؤول، أو لم تحصل على حذف الحقوق.")

    return ""
Beispiel #8
0
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("Peyamên {} hat qifl kirin!".format(
                    args[0]))

                return ""

            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("Li vir {} hat qifl kirin!".format(args[0]))
                return ""

            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 ""
Beispiel #9
0
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 😎 Iny admin allatha oraaleyum njan {} ayakkan anuvathikilla. 😈".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("Locked 😎 Iny admin allatha oraaleyum njan {} ayakkan anuvathikilla. 😈 ".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("Enthaada lock cheyyendath..? link sharing venel ozhivaakkaam. veno..? 🤔  urls lock cheyyan /lock url ennu type chey. allenkil /locltypes nokkittu para ithil ullathekke enik lock cheyyan pattum. 😎")

    else:
        message.reply_text("da njan admin allello aadyam ene admin aakku ennaale enik ithekke manage cheyyan pattu.. 😟")

    return ""
Beispiel #10
0
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("Zablokowano {} wiadomości dla wszystkich nie-administratorów!".format(args[0]))

                return "<b>{}:</b>" \
                       "\n#BLOKADA" \
                       "\n<b>Administrator:</b> {}" \
                       "\nLZablokowano <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("Zablokowano {} wiadomości dla wszystkich nie-administratorów!".format(args[0]))
                return "<b>{}:</b>" \
                       "\n#BLOKADA" \
                       "\n<b>Administrator:</b> {}" \
                       "\nLZablokowano <code>{}</code>.".format(html.escape(chat.title),
                                                                mention_html(user.id, user.first_name), args[0])

            else:
                message.reply_text("Co ty chcesz zablokować...? Sprawdź listę możliwych blokad poprzez /locktypes")

    else:
        message.reply_text("Nie jestem administratorem lub nie mam uprawnień do usuwania.")

    return ""
Beispiel #11
0
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("අගුළු දමා ඇත {} සියලුම පරිපාලකයින් නොවන අයට පණිවිඩ! ”.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("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("ඔබ අගුලු දැමීමට උත්සාහ කරන්නේ කුමක්ද ...? අගුළු දැමීමේ ලැයිස්තුව සඳහා / ලොක් ටයිප් උත්සාහ කරන්න")

    else:
        message.reply_text("Iමම පරිපාලකයෙක් නොවේ, හෝ මකාදැමීමේ අයිතිවාසිකම් ලබාගෙන නොමැත.")

    return ""
Beispiel #12
0
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]))

                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("{} kilitləndi!".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("Sən nəyi kilitləməyi düşünürsən?...? /locktypes yazaraq siyahıya baxa bilərsən.")

    else:
        message.reply_text("Səlahiyyət yoxdur.")

    return ""
Beispiel #13
0
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("ഞാൻ {} ലോക്ക് ചെയ്തു. അഡ്മിൻ അല്ലാത്തവർക്ക് ഇനി അയക്കുവാൻ സാധിക്കില്ല.!".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("ഞാൻ {} ലോക്ക് ചെയ്തു. അഡ്മിൻ അല്ലാത്തവർക്ക് ഇനി അയക്കുവാൻ സാധിക്കില്ല.!".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("നിങ്ങൾ എന്താണ് ലോക്ക് ചെയ്യാൻ ശ്രമിക്കുന്നത് ...? /locktypes ലോക്ക് ടൈപ്പ് നോക്കിയിട്ട് അയക്കു..")

    else:
        message.reply_text("ഞാൻ ഒരു അഡ്മിനിസ്ട്രേറ്റർ അല്ല, അല്ലെങ്കിൽ എനിക്ക് ലോക്ക് ചെയ്യാൻ ഉള്ള പരിമിതികൾ തന്നിട്ടില്ല.")

    return ""
Beispiel #14
0
def lock(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 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),
                        permissions=ChatPermissions(
                            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),
                        permissions=ChatPermissions(
                            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 ""
Beispiel #15
0
def lock(update: Update) -> str:
    chat = update.effective_chat  # type: Optional[Chat]
    user = update.effective_user  # type: Optional[User]
    message = update.effective_message  # type: Optional[Message]
    args = message.text.split(" ")

    if can_delete(chat, context.bot.id):
        if len(args) >= 2:
            if args[1] in LOCK_TYPES:
                sql.update_lock(chat.id, args[1], locked=True)
                message.reply_text(
                    "Locked {} messages for all non-admins!".format(args[1]))

                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[1])
            elif args[1] in "all":
                context.bot.set_chat_permissions(update.message.chat.id,
                                                 LOCK_PERMISSIONS)
                sql.update_restriction(chat.id, args[1], locked=True)
                message.reply_text(
                    "Locked {} messages for all non-admins!".format(args[1]))
                context.bot.send_message(chat.id,
                                         "***Chat is currently muted.***",
                                         parse_mode=ParseMode.MARKDOWN)

                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[1])

            elif args[1] in RESTRICTION_TYPES:
                sql.update_restriction(chat.id, args[1], locked=True)
                if args[1] == "previews":
                    members = users_sql.get_chat_members(str(chat.id))
                    restr_members(context.bot,
                                  chat.id,
                                  members,
                                  messages=True,
                                  media=True,
                                  other=True)

                message.reply_text("Locked {} for all non-admins!".format(
                    args[1]))
                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[1])

            else:
                message.reply_text(
                    "You've entered an unknown locktypes, Try /locktypes for the list of lockables"
                )

    else:
        message.reply_text(
            "I'm not an administrator, or haven't got delete rights.")

    return ""