added and updaded help
This commit is contained in:
24
src/modules/help.py
Normal file
24
src/modules/help.py
Normal file
@ -0,0 +1,24 @@
|
||||
from telebot.async_telebot import AsyncTeleBot
|
||||
from telebot.types import Message
|
||||
import logging
|
||||
|
||||
from config import COMMAND_MESSAGES
|
||||
|
||||
logger = logging.getLogger(__name__) # Получаем логгер для текущего модуля
|
||||
|
||||
def register_handlers(bot: AsyncTeleBot): # Регистрирует все обработчики команд
|
||||
|
||||
@bot.message_handler(commands=['help']) # Обработчик команды /help
|
||||
async def help_command(message: Message):
|
||||
|
||||
# Отправка сообщения в тему или обычный чат
|
||||
send_message = bot.reply_to if message.is_topic_message else bot.send_message
|
||||
chat_id = message if message.is_topic_message else message.chat.id
|
||||
|
||||
try:
|
||||
|
||||
await send_message(chat_id, COMMAND_MESSAGES['help'])
|
||||
logger.info(f"Пользователь {message.from_user.id} запустил /help.")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Пользователь {message.from_user.id} запустил /help: {str(e)}")
|
Reference in New Issue
Block a user