From 82a2a5dafba7ff3fbacce6ea88c77ed8930e675c Mon Sep 17 00:00:00 2001 From: krosh Date: Sun, 9 Mar 2025 08:19:30 +0300 Subject: [PATCH] another fixes --- app/config.py | 14 ++++++++------ app/main.py | 8 +++++--- app/plugin/admin.py | 2 -- app/plugin/bot_instance.py | 1 + app/plugin/register.py | 1 + app/plugin/test.py | 2 +- app/plugin/user.py | 2 +- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/app/config.py b/app/config.py index 63d87d7..671576a 100755 --- a/app/config.py +++ b/app/config.py @@ -37,12 +37,14 @@ class Messages: ) # несколько сообщений подряд ] HELPS = [ - "Доступные команды:" "\n/start - начать регистрацию", - "\n/help - помощь", - "\n/source - исходный код бота на Github", - "\n@more_logical - для всех вопросов по мероприятию", - "\n\nCreated by АйТи блок ВМК with love ❤️", - # "Начало мероприятия: {} \nЭто через целых {} минут!", + ( + "Доступные команды:" + "\n/start - начать регистрацию" + "\n/help - помощь" + "\n/source - исходный код бота на Github" + "\n@more_logical - для всех вопросов по мероприятию" + "\n\nCreated by АйТи блок ВМК with love ❤️" + ) ] ERROR = "Произошла ошибка" diff --git a/app/main.py b/app/main.py index c93a0d4..d422eeb 100755 --- a/app/main.py +++ b/app/main.py @@ -62,7 +62,7 @@ def help_message(message: types.Message): for msg in Messages.HELPS: bot.send_message(message.chat.id, msg) else: - bot.send_message(message.chat.id, AdminMessages.ADMIN_HELP, parse_mode="HTML") + bot.send_message(message.chat.id, AdminMessages.ADMIN_HELP) return @@ -71,8 +71,10 @@ def help_message(message: types.Message): def source(message: types.Message): bot.send_message( message.chat.id, - "[Страничка бота на Github!](https://github.com/kr0sh512/rc-tgbot)\n\nСтарался раб профкомский [Дмитрий](https://t.me/kr0sh_512). mewow.", - parse_mode="Markdown", + ( + "Страничка бота на Github!" + "\n\nСтарался раб профкомский Дмитрий. mewow." + ), ) return diff --git a/app/plugin/admin.py b/app/plugin/admin.py index 7019488..521cf31 100755 --- a/app/plugin/admin.py +++ b/app/plugin/admin.py @@ -152,7 +152,6 @@ class Admin: bot.send_message( message.chat.id, "Ваш ключ: {}".format(key), - parse_mode="HTML", ) except Exception as e: bot.send_message(message.chat.id, str(e)) @@ -253,7 +252,6 @@ class Admin: bot.send_message( message.chat.id, "Отправьте delete all для подтверждения. \n\nВнимание, вы вряд ли хотите это делать.", - parse_mode="HTML", ) return diff --git a/app/plugin/bot_instance.py b/app/plugin/bot_instance.py index 73a8569..afb4875 100755 --- a/app/plugin/bot_instance.py +++ b/app/plugin/bot_instance.py @@ -38,6 +38,7 @@ telebot.TeleBot.send_message = send_message_with_try_catch bot = telebot.TeleBot( config.API_TOKEN, colorful_logs=True, + parse_mode="HTML", ) threading.Thread( diff --git a/app/plugin/register.py b/app/plugin/register.py index 039e056..14c7866 100755 --- a/app/plugin/register.py +++ b/app/plugin/register.py @@ -152,6 +152,7 @@ def test_question(call: types.CallbackQuery): text_edit, call.message.chat.id, call.message.message_id, + parse_mode="HTML", ) # упростить if len(user.type) == 4: diff --git a/app/plugin/test.py b/app/plugin/test.py index d62581d..93ff9f3 100755 --- a/app/plugin/test.py +++ b/app/plugin/test.py @@ -10,7 +10,7 @@ class TestMessages: "question": "Когда вы оказываетесь в новой компании людей, вы, как правило:", "answers": [ ( - "Легко заводите разговоры с разными людьми.", + "Легко заводите разговоры с разными людьми.", "E", ), ( diff --git a/app/plugin/user.py b/app/plugin/user.py index 18c1851..06593eb 100755 --- a/app/plugin/user.py +++ b/app/plugin/user.py @@ -132,7 +132,7 @@ class User: @staticmethod def start_shuffle_reg(): users_reg.clear() - users = [user for user in User.get_all() if len(user.type) == 4] + users = [user for user in User.get_all() if (user.type and len(user.type) == 4)] markup = types.InlineKeyboardMarkup() markup.add(