summaryrefslogtreecommitdiff
path: root/predicates.py
diff options
context:
space:
mode:
authorMikhail Kirillov <w96k@runbox.com>2024-10-10 06:20:52 +0400
committerMikhail Kirillov <w96k@runbox.com>2024-10-10 06:20:52 +0400
commit23bddf358dc615d18ed4470f33f383f1eac9ac63 (patch)
tree9d9ac4e9aa31c237b9a7776abc27dcd597d6d4e6 /predicates.py
parent8d2d5acde9d4d7d44d93c386e541692f4e45a271 (diff)
Task #10. /announce command
Diffstat (limited to 'predicates.py')
-rw-r--r--predicates.py7
1 files changed, 7 insertions, 0 deletions
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"])