🗝
summary refs log tree commit diff
path: root/conf_pain.py
diff options
context:
space:
mode:
Diffstat (limited to 'conf_pain.py')
-rw-r--r--conf_pain.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/conf_pain.py b/conf_pain.py
index 85e7095..9690de1 100644
--- a/conf_pain.py
+++ b/conf_pain.py
@@ -1,14 +1,17 @@
 import math
 from datetime import UTC, datetime, timedelta
 
-from com import FilterableNote
+from com import FilterableNote, FilterAction
 from sec import connect, tokens
 
 user_id = "9gszslkcdfnomssj"
 token = tokens["pain"]
-api = "https://void.rehab/api/"
+api = "https://void.rehab/api"
 
-def criteria(root: FilterableNote) -> bool:
+def criteria(root: FilterableNote) -> (bool, FilterAction):
     # if it's more than two months old, delete
-    # return (datetime.now(UTC) - root.when).days > 60
-    return (datetime.now(UTC) - root.when).days > (12 * 30)
+    latest = max(map(lambda note: note.when, root.thread_self()))
+    if (datetime.now(UTC) - latest).days > 60:
+        return FilterAction.Obliterate
+    else:
+        return FilterAction.Ignore