aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar wookie184 <[email protected]>2023-02-26 17:37:19 +0000
committerGravatar wookie184 <[email protected]>2023-02-26 17:37:19 +0000
commitc66efd745e639aac5166d6ccc53e64990b19341c (patch)
treea065b35fd8f30417510f5d197f94b365a4e4fe17
parentAdd nomination_discussion channel constant (diff)
Add nominations api method to get activity
-rw-r--r--bot/exts/recruitment/talentpool/_api.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/bot/exts/recruitment/talentpool/_api.py b/bot/exts/recruitment/talentpool/_api.py
index c00c8c09c..7b6c67fc3 100644
--- a/bot/exts/recruitment/talentpool/_api.py
+++ b/bot/exts/recruitment/talentpool/_api.py
@@ -112,3 +112,21 @@ class NominationAPI:
}
result = await self.site_api.post("bot/nominations", json=data)
return Nomination.parse_obj(result)
+
+ async def get_activity(
+ self,
+ user_ids: list[int],
+ *,
+ days: int,
+ ) -> dict[int, int]:
+ """
+ Get the number of messages sent in the past `days` days by users with the given IDs.
+
+ Returns a dictionary mapping user ID to message count.
+ """
+ result = await self.site_api.post(
+ "bot/users/metricity_activity_data",
+ json=user_ids,
+ params={"days": str(days)}
+ )
+ return {int(user_id): message_count for user_id, message_count in result.items()}