From 1f94544ff6c9357b2911dfa5ca50f3e007963332 Mon Sep 17 00:00:00 2001 From: Mikhail Kirillov Date: Thu, 10 Oct 2024 06:53:36 +0400 Subject: Remove /movies_remove command. --- commands/movie.py | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'commands/movie.py') 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"]) - ) -- cgit v1.2.3