diff options
-rw-r--r-- | commands/__init__.py | 2 | ||||
-rw-r--r-- | commands/movie.py | 26 | ||||
-rw-r--r-- | main.py | 1 |
3 files changed, 8 insertions, 21 deletions
diff --git a/commands/__init__.py b/commands/__init__.py index 7081c89..17abd8c 100644 --- a/commands/__init__.py +++ b/commands/__init__.py @@ -12,7 +12,7 @@ from .meta import about from .users import set_users, add_users, list_users, remove_users, \ chooser_user, who_is_next -from .movie import movie, movies, remove_movies +from .movie import movie, movies from .event import create_event, list_events from .announce import create_announcement 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"]) - ) @@ -63,7 +63,6 @@ if __name__ == "__main__": # 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)) |