Changeset 69dd60c in python-cinema-club-bot for commands/movie.py


Ignore:
Timestamp:
Oct 11, 2024, 1:53:24 AM (5 weeks ago)
Author:
Mikhail Kirillov <w96k@…>
Branches:
master
Children:
ac7b16a
Parents:
694d823
Message:

Task #30. Allow anyone create or edit upcoming event

File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands/movie.py

    r694d823 r69dd60c  
    1414from imdb import Cinemagoer
    1515
    16 from utils import context_init, choose_next_user
    17 from predicates import has_finished_event
     16from utils import context_init, choose_next_user, normalize_username, \
     17    init_new_event
     18from predicates import has_finished_movie
    1819from strings import MOVIE_NOT_PROVIDED, EXPECTED_ONE_MOVIE, \
    1920    MOVIE_ANOTHER_USER, FETCHING_MOVIE, FETCHING_ERROR, \
     
    3839    username = update.message.from_user.username
    3940
    40     if has_finished_event(context, chooser):
    41         users = context.chat_data["users"] = choose_next_user(users)
    42         raise error.TelegramError(MOVIE_ANOTHER_USER.format(users[0]))
     41    if has_finished_movie(context):
     42        users = context.chat_data["users"] = choose_next_user(context)
    4343
    4444    if "@"+username != chooser:
     
    6464        id=movie.getID(),
    6565        user=update.effective_user.username,
    66         poster=movie.data.get("cover url"),
    6766        rating=movie.data.get("rating"),
    6867        genres=movie.data.get("genres"),
     
    8180            context.chat_data["events"][-1] = last_event
    8281    else:
     82        init_new_event(context, users[0], movie_dict["title"])
    8383        context.chat_data["movies"].append(movie_dict)
    8484
     
    101101        movies_formatted += MOVIES_LIST.format(
    102102            title=movie["title"],
    103             id=movie["id"],
    104103            user=movie["user"]
    105104        )
Note: See TracChangeset for help on using the changeset viewer.