summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'main.py')
-rw-r--r--main.py13
1 files changed, 11 insertions, 2 deletions
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)