Changeset 1f94544
- Timestamp:
- Oct 10, 2024, 6:53:36 AM (5 weeks ago)
- Branches:
- master
- Children:
- 5ba045c
- Parents:
- 23bddf3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
commands/__init__.py
r23bddf3 r1f94544 13 13 from .users import set_users, add_users, list_users, remove_users, \ 14 14 chooser_user, who_is_next 15 from .movie import movie, movies , remove_movies15 from .movie import movie, movies 16 16 from .event import create_event, list_events 17 17 from .announce import create_announcement -
commands/movie.py
r23bddf3 r1f94544 73 73 context.chat_data["movies"][-1]["user"] == username: 74 74 context.chat_data["movies"][-1] = movie_dict 75 76 last_event = context.chat_data["events"][-1] \ 77 if len(context.chat_data["events"]) > 0 else None 78 79 if last_event and context.chat_data["events"][-1]["user"] == username: 80 last_event["title"] = movie_dict["title"] 81 context.chat_data["events"][-1] = last_event 75 82 else: 76 83 context.chat_data["movies"].append(movie_dict) … … 103 110 await update.message.reply_text(movies_formatted) 104 111 105 106 async def remove_movies(107 update: Update,108 context: ContextTypes.DEFAULT_TYPE109 ) -> None:110 context_init(context)111 112 if context.args == []:113 raise error.TelegramError(MOVIE_NOT_PROVIDED)114 115 movies = context.chat_data["movies"]116 117 for movie_id in context.args:118 for movie in movies:119 if movie["id"] == movie_id:120 context.chat_data["movies"].remove(movie)121 await update.message.reply_text(122 MOVIE_REMOVE.format(title=movie["title"], id=movie["id"])123 ) -
main.py
r23bddf3 r1f94544 64 64 app.add_handler(CommandHandler("movie", commands.movie)) 65 65 app.add_handler(CommandHandler("movies", commands.movies)) 66 app.add_handler(CommandHandler("movies_remove", commands.remove_movies))67 66 68 67 # Users commands
Note:
See TracChangeset
for help on using the changeset viewer.