diff options
author | 2024-05-13 01:07:28 +0100 | |
---|---|---|
committer | 2024-05-13 01:07:28 +0100 | |
commit | dd2abe55f4a4ad3fa03db0ecd84292ff745607b7 (patch) | |
tree | 40ce5815813bd7a734496ade88dff79362b7c09c | |
parent | Bump ruff from 0.4.3 to 0.4.4 (#3043) (diff) |
Add new Talentpool API method for fetching a nomination reason
-rw-r--r-- | bot/exts/recruitment/talentpool/_api.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bot/exts/recruitment/talentpool/_api.py b/bot/exts/recruitment/talentpool/_api.py index f7b243209..8cd8eb56a 100644 --- a/bot/exts/recruitment/talentpool/_api.py +++ b/bot/exts/recruitment/talentpool/_api.py @@ -59,6 +59,17 @@ class NominationAPI: nomination = Nomination.model_validate(data) return nomination + async def get_nomination_reason(self, user_id: int, actor_id: int) -> tuple[Nomination, str] | None: + """Search for a nomination & reason for a specific actor on a specific user.""" + nominations = await self.get_nominations(user_id, True) + + for nomination in nominations: + for entry in nomination.entries: + if entry.actor_id == actor_id: + return nomination, entry.reason + + return None + async def edit_nomination( self, nomination_id: int, |