summaryrefslogtreecommitdiff
path: root/commands/movie.py
diff options
context:
space:
mode:
Diffstat (limited to 'commands/movie.py')
-rw-r--r--commands/movie.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/commands/movie.py b/commands/movie.py
index adb05ac..de0092b 100644
--- a/commands/movie.py
+++ b/commands/movie.py
@@ -13,8 +13,9 @@ from telegram import Update, error
from telegram.ext import ContextTypes
from imdb import Cinemagoer
-from utils import context_init, choose_next_user
-from predicates import has_finished_event
+from utils import context_init, choose_next_user, normalize_username, \
+ init_new_event
+from predicates import has_finished_movie
from strings import MOVIE_NOT_PROVIDED, EXPECTED_ONE_MOVIE, \
MOVIE_ANOTHER_USER, FETCHING_MOVIE, FETCHING_ERROR, \
MOVIE_REMOVE, MOVIE_SET, MOVIES_LIST, NO_MOVIES, ADD_MORE_USERS
@@ -37,9 +38,8 @@ async def movie(
chooser = users[0]
username = update.message.from_user.username
- if has_finished_event(context, chooser):
- users = context.chat_data["users"] = choose_next_user(users)
- raise error.TelegramError(MOVIE_ANOTHER_USER.format(users[0]))
+ if has_finished_movie(context):
+ users = context.chat_data["users"] = choose_next_user(context)
if "@"+username != chooser:
raise error.TelegramError(MOVIE_ANOTHER_USER.format(user=chooser))
@@ -63,7 +63,6 @@ async def movie(
title=movie.data.get("title"),
id=movie.getID(),
user=update.effective_user.username,
- poster=movie.data.get("cover url"),
rating=movie.data.get("rating"),
genres=movie.data.get("genres"),
runtime=movie.data.get("runtimes"),
@@ -80,6 +79,7 @@ async def movie(
last_event["title"] = movie_dict["title"]
context.chat_data["events"][-1] = last_event
else:
+ init_new_event(context, users[0], movie_dict["title"])
context.chat_data["movies"].append(movie_dict)
await update.message.reply_text(
@@ -100,7 +100,6 @@ async def movies(
for movie in movies:
movies_formatted += MOVIES_LIST.format(
title=movie["title"],
- id=movie["id"],
user=movie["user"]
)