From cfd2a24e25649d64c214c268e73a9aaa18282cea Mon Sep 17 00:00:00 2001 From: StNicolay <103897650+StNicolay@users.noreply.github.com> Date: Fri, 14 Oct 2022 20:16:46 +0300 Subject: [PATCH] Added help command --- src/bot/__init__.py | 3 +++ src/bot/handlers.py | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/bot/__init__.py b/src/bot/__init__.py index 358c091..b40789c 100644 --- a/src/bot/__init__.py +++ b/src/bot/__init__.py @@ -35,4 +35,7 @@ def create_bot(token: str, engine: mariadb.Connection) -> telebot.TeleBot: functools.partial(handlers.delete_account, bot, engine), commands=["delete_account"], ) + bot.register_message_handler( + functools.partial(handlers.help, bot), commands=["help", "start"] + ) return bot diff --git a/src/bot/handlers.py b/src/bot/handlers.py index 181d68e..ebe8c23 100644 --- a/src/bot/handlers.py +++ b/src/bot/handlers.py @@ -167,3 +167,15 @@ def delete_account( database.delete.delete_account(engine, mes.from_user.id, data[1]) _send_tmp_message(bot, mes.chat.id, "Аккаунт удалён") + + +def help(bot: telebot.TeleBot, mes: telebot.types.Message) -> None: + message = """Команды: +/set_master_pass {Мастер пароль} - установить мастер пароль +/add_account {Название} {Логин} {Пароль} {Мастер пароль} - создать аккаунт +/get_accounts - получить список аккаунтов +/get_account {Название} {Мастер пароль} - получить логин и пароль аккаунта +/delete_account {Название} - удалить аккаунт +/delete_all - удалить все аккаунты и мастер пароль +/reset_master_pass {Новый мастер пароль} - удалить все аккаунты и изменить мастер пароль""" + bot.send_message(mes.chat.id, message)