summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorMikhail Kirillov <w96k@runbox.com>2024-10-09 04:53:26 +0400
committerMikhail Kirillov <w96k@runbox.com>2024-10-09 22:46:19 +0400
commit662342863e37e8661f818218df7bb72bc18bf4eb (patch)
tree79ff9b3884a36e7afec820a8b7c3f235f2e6f1f1 /main.py
parent0d48ea28aeb8a6290d2aeab202efa9c8d6e30fe3 (diff)
Add movies commands
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)