summaryrefslogtreecommitdiff
path: root/commands/movie.py
diff options
context:
space:
mode:
authorMikhail Kirillov <w96k@runbox.com>2024-10-10 06:53:36 +0400
committerMikhail Kirillov <w96k@runbox.com>2024-10-10 06:53:36 +0400
commit1f94544ff6c9357b2911dfa5ca50f3e007963332 (patch)
treea5d275ef99729de0469c655b96a850c8e3961b85 /commands/movie.py
parent23bddf358dc615d18ed4470f33f383f1eac9ac63 (diff)
Remove /movies_remove command.
Diffstat (limited to 'commands/movie.py')
-rw-r--r--commands/movie.py26
1 files changed, 7 insertions, 19 deletions
diff --git a/commands/movie.py b/commands/movie.py
index 256156f..adb05ac 100644
--- a/commands/movie.py
+++ b/commands/movie.py
@@ -72,6 +72,13 @@ async def movie(
if len(context.chat_data["movies"]) > 0 and \
context.chat_data["movies"][-1]["user"] == username:
context.chat_data["movies"][-1] = movie_dict
+
+ last_event = context.chat_data["events"][-1] \
+ if len(context.chat_data["events"]) > 0 else None
+
+ if last_event and context.chat_data["events"][-1]["user"] == username:
+ last_event["title"] = movie_dict["title"]
+ context.chat_data["events"][-1] = last_event
else:
context.chat_data["movies"].append(movie_dict)
@@ -102,22 +109,3 @@ async def movies(
await update.message.reply_text(movies_formatted)
-
-async def remove_movies(
- update: Update,
- context: ContextTypes.DEFAULT_TYPE
-) -> None:
- context_init(context)
-
- if context.args == []:
- raise error.TelegramError(MOVIE_NOT_PROVIDED)
-
- movies = context.chat_data["movies"]
-
- for movie_id in context.args:
- for movie in movies:
- if movie["id"] == movie_id:
- context.chat_data["movies"].remove(movie)
- await update.message.reply_text(
- MOVIE_REMOVE.format(title=movie["title"], id=movie["id"])
- )