From 600b022e8a4dec65ad3d8d56176dc101b9c6bfbe Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Thu, 1 Sep 2022 18:44:55 +0300 Subject: [PATCH] Reaction on mentions only in monday,sunday --- src/listener_mention.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/listener_mention.py b/src/listener_mention.py index 8e8d237..b2fbe85 100644 --- a/src/listener_mention.py +++ b/src/listener_mention.py @@ -11,9 +11,16 @@ acct_admin_bot=main_admin_bot def get_control_mention(acct_admin_bot=str): while True: + now_week = datetime.now().weekday() + if now_week not in (0, 6): + time.sleep(30) + continue notif = get_notifications() for i in notif: - if i['account']['acct'] == acct_admin_bot and i['pleroma']['is_seen'] == False and i['status']['in_reply_to_id'] == None: + seen = i['pleroma']['is_seen'] + acct_mention = i['account']['acct'] + reply_to_id = i['status']['in_reply_to_id'] + if acct_mention == acct_admin_bot and seen == False and reply_to_id == None and now_week in (0, 6): st_id = i['status']['id'] st_date = i['status']['created_at'] thread_created_at = dateutilparse(st_date)