From 23bddf358dc615d18ed4470f33f383f1eac9ac63 Mon Sep 17 00:00:00 2001 From: Mikhail Kirillov Date: Thu, 10 Oct 2024 06:20:52 +0400 Subject: Task #10. /announce command --- predicates.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'predicates.py') diff --git a/predicates.py b/predicates.py index 992972d..c341ccf 100644 --- a/predicates.py +++ b/predicates.py @@ -29,3 +29,10 @@ def has_finished_event( return last_event is not None and \ last_event["user"] == normalize_username(username) and \ is_past(last_event["when"]) + + +def has_unfinished_event(context: ContextTypes.DEFAULT_TYPE) -> bool: + events = context.chat_data["events"] + last_event = events[-1] if events != [] else None + + return False if last_event is None else not is_past(last_event["when"]) -- cgit v1.2.3