From 2b91d414ca72b0f3700866154d9421058a651596 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Mon, 5 Sep 2022 01:19:46 +0300 Subject: [PATCH] Fix very strange error: get mentions includes other types --- src/fedi_api.py | 4 ++-- src/listener_mention.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fedi_api.py b/src/fedi_api.py index db030e7..b61edab 100644 --- a/src/fedi_api.py +++ b/src/fedi_api.py @@ -17,9 +17,9 @@ headers= { def get_notifications(): params = { "limit": 15, - "type": "mention" + "types": ["mention"] } - r = requests.get(instance_point + "/notifications", params, headers=headers) + r = requests.get(instance_point + "/notifications", json=params, headers=headers) return r.json() diff --git a/src/listener_mention.py b/src/listener_mention.py index 6521aab..c5939ee 100644 --- a/src/listener_mention.py +++ b/src/listener_mention.py @@ -20,6 +20,8 @@ def get_control_mention(): notif = get_notifications() for i in notif: + if i['type'] != "mention": + continue seen = i['pleroma']['is_seen'] acct_mention = i['account']['acct'] reply_to_id = i['status']['in_reply_to_id']