def ban_user_command(self, bot, update):
chat_id = update.message.chat_id
if not config.get_state(_password_enabled_key):
bot.send_message(chat_id=chat_id, text="Password is disabled")
return
if not _clients:
bot.send_message(chat_id=chat_id, text="No clients logged in")
return
text = "Who should be banned?"
keyboard_items = list(
map(lambda client: InlineKeyboardButton(text=client.name, callback_data=str(client.user_id)), _clients))
@decorators.callback_keyboard_answer_handler
def _action(chat_id, data):
global _clients
global _password
_clients = set(filter(lambda client: str(client.user_id) != data, _clients))
_password = None
return "Banned user. Please set a new password."
self.send_callback_keyboard(bot, chat_id, text, keyboard_items, _action)
评论列表
文章目录