diff options
author | 2021-10-03 22:57:32 +0100 | |
---|---|---|
committer | 2021-10-03 22:57:32 +0100 | |
commit | d444ebd8c3f9b10e021ecc94da8bbac482a1b236 (patch) | |
tree | f6cefb2bdeeab2b78716c500d825ed23d534e302 | |
parent | Block helpers from editing nomination reasons in channels other than #nominat... (diff) |
Check cache for Members and Users
By swapping the isinstance to check for int, the else block now catches the case where target is Member or User, this allows for editting the nomination reason of members that are off server.
-rw-r--r-- | bot/exts/recruitment/talentpool/_cog.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bot/exts/recruitment/talentpool/_cog.py b/bot/exts/recruitment/talentpool/_cog.py index 98e83f309..193be2095 100644 --- a/bot/exts/recruitment/talentpool/_cog.py +++ b/bot/exts/recruitment/talentpool/_cog.py @@ -6,7 +6,7 @@ from typing import Optional, Union import discord from async_rediscache import RedisCache -from discord import Color, Embed, Member, PartialMessage, RawReactionActionEvent +from discord import Color, Embed, Member, PartialMessage, RawReactionActionEvent, User from discord.ext.commands import BadArgument, Cog, Context, group, has_any_role from bot.api import ResponseCodeError @@ -395,7 +395,7 @@ class TalentPool(Cog, name="Talentpool"): self, ctx: Context, *, - target: Union[int, Member], + target: Union[int, Member, User], actor: MemberOrUser, reason: str, ) -> None: @@ -403,14 +403,14 @@ class TalentPool(Cog, name="Talentpool"): if len(reason) > REASON_MAX_CHARS: await ctx.send(f":x: Maximum allowed characters for the reason is {REASON_MAX_CHARS}.") return - if isinstance(target, Member): + if isinstance(target, int): + nomination_id = target + else: if nomination := self.cache.get(target.id): nomination_id = nomination["id"] else: await ctx.send("No active nomination found for that member.") return - else: - nomination_id = target try: nomination = await self.bot.api_client.get(f"bot/nominations/{nomination_id}") |