Changeset 23bddf3 in python-cinema-club-bot for predicates.py


Ignore:
Timestamp:
Oct 10, 2024, 6:20:52 AM (5 weeks ago)
Author:
Mikhail Kirillov <w96k@…>
Branches:
master
Children:
1f94544
Parents:
8d2d5ac
Message:

Task #10. /announce command

File:
1 edited

Legend:

Unmodified
Added
Removed
  • predicates.py

    r8d2d5ac r23bddf3  
    3030        last_event["user"] == normalize_username(username) and \
    3131        is_past(last_event["when"])
     32
     33
     34def has_unfinished_event(context: ContextTypes.DEFAULT_TYPE) -> bool:
     35    events = context.chat_data["events"]
     36    last_event = events[-1] if events != [] else None
     37
     38    return False if last_event is None else not is_past(last_event["when"])
Note: See TracChangeset for help on using the changeset viewer.