Changeset 1f94544 in python-cinema-club-bot for commands/movie.py


Ignore:
Timestamp:
Oct 10, 2024, 6:53:36 AM (5 weeks ago)
Author:
Mikhail Kirillov <w96k@…>
Branches:
master
Children:
5ba045c
Parents:
23bddf3
Message:

Remove /movies_remove command.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands/movie.py

    r23bddf3 r1f94544  
    7373       context.chat_data["movies"][-1]["user"] == username:
    7474        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
    7582    else:
    7683        context.chat_data["movies"].append(movie_dict)
     
    103110    await update.message.reply_text(movies_formatted)
    104111
    105 
    106 async def remove_movies(
    107         update: Update,
    108         context: ContextTypes.DEFAULT_TYPE
    109 ) -> 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                 )
Note: See TracChangeset for help on using the changeset viewer.