From 662342863e37e8661f818218df7bb72bc18bf4eb Mon Sep 17 00:00:00 2001 From: Mikhail Kirillov Date: Wed, 9 Oct 2024 04:53:26 +0400 Subject: Add movies commands --- main.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index 10c05a7..6035f76 100644 --- a/main.py +++ b/main.py @@ -16,7 +16,7 @@ from dotenv import load_dotenv import os import logging -from strings import INVALID_COMMAND +from strings import INVALID_COMMAND, UNDEFINED_ERROR from persistence import Persistence import commands @@ -38,9 +38,12 @@ async def unknown(update: Update, context: ContextTypes.DEFAULT_TYPE): async def error_handler(update: object, context: ContextTypes.DEFAULT_TYPE) -> None: logging.error("Exception:", exc_info=context.error) + error_message = context.error.message \ + if hasattr(context.error, "message") else UNDEFINED_ERROR + await context.bot.send_message( chat_id=update.effective_chat.id, - text=context.error.message + text=error_message ) if __name__ == "__main__": @@ -52,11 +55,17 @@ if __name__ == "__main__": app.add_handler(CommandHandler("about", commands.about)) # Movie commands + app.add_handler(CommandHandler("movie", commands.movie)) + app.add_handler(CommandHandler("movies", commands.movies)) + app.add_handler(CommandHandler("movies_remove", commands.remove_movies)) + + # Users commands app.add_handler(CommandHandler("set", commands.set_users)) app.add_handler(CommandHandler("add", commands.add_users)) app.add_handler(CommandHandler("list", commands.list_users)) app.add_handler(CommandHandler("remove", commands.remove_users)) app.add_handler(CommandHandler("chooser", commands.chooser_user)) + app.add_handler(CommandHandler("next", commands.who_is_next)) app.add_handler(MessageHandler(filters.COMMAND, unknown)) app.add_error_handler(error_handler) -- cgit v1.2.3