diff options
author | 2023-02-26 17:37:19 +0000 | |
---|---|---|
committer | 2023-02-26 17:37:19 +0000 | |
commit | c66efd745e639aac5166d6ccc53e64990b19341c (patch) | |
tree | a065b35fd8f30417510f5d197f94b365a4e4fe17 | |
parent | Add nomination_discussion channel constant (diff) |
Add nominations api method to get activity
-rw-r--r-- | bot/exts/recruitment/talentpool/_api.py | 18 |
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()} |