diff options
author | 2022-06-09 09:11:25 +0100 | |
---|---|---|
committer | 2022-06-09 09:11:25 +0100 | |
commit | c7b290f977403b697d9164396c46006b0717f96d (patch) | |
tree | af03758d97deff81f0454777424f1eb9191c3fc9 | |
parent | chore: Remove allowed_strings in favour of Literal (diff) | |
parent | Merge main into nominations-tagging (diff) |
Merge pull request #2040 from Shom770/nominations-tagging
-rw-r--r-- | bot/exts/recruitment/talentpool/_cog.py | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/bot/exts/recruitment/talentpool/_cog.py b/bot/exts/recruitment/talentpool/_cog.py index ef3236393..9819152b0 100644 --- a/bot/exts/recruitment/talentpool/_cog.py +++ b/bot/exts/recruitment/talentpool/_cog.py @@ -97,33 +97,33 @@ class TalentPool(Cog, name="Talentpool"): manually reviewed with the `tp post_review <user_id>` command. """ if await self.autoreview_enabled(): - await ctx.send(":x: Autoreview is already enabled") + await ctx.send(":x: Autoreview is already enabled.") return await self.talentpool_settings.set(AUTOREVIEW_ENABLED_KEY, True) await self.reviewer.reschedule_reviews() - await ctx.send(":white_check_mark: Autoreview enabled") + await ctx.send(":white_check_mark: Autoreview enabled.") @nomination_autoreview_group.command(name="disable", aliases=("off",)) @has_any_role(Roles.admins) async def autoreview_disable(self, ctx: Context) -> None: """Disable automatic posting of reviews.""" if not await self.autoreview_enabled(): - await ctx.send(":x: Autoreview is already disabled") + await ctx.send(":x: Autoreview is already disabled.") return await self.talentpool_settings.set(AUTOREVIEW_ENABLED_KEY, False) self.reviewer.cancel_all() - await ctx.send(":white_check_mark: Autoreview disabled") + await ctx.send(":white_check_mark: Autoreview disabled.") @nomination_autoreview_group.command(name="status") @has_any_role(*MODERATION_ROLES) async def autoreview_status(self, ctx: Context) -> None: """Show whether automatic posting of reviews is enabled or disabled.""" if await self.autoreview_enabled(): - await ctx.send("Autoreview is currently enabled") + await ctx.send("Autoreview is currently enabled.") else: - await ctx.send("Autoreview is currently disabled") + await ctx.send("Autoreview is currently disabled.") @nomination_group.command( name="nominees", @@ -240,7 +240,7 @@ class TalentPool(Cog, name="Talentpool"): f"Use `{BotConfig.prefix}tp forcenominate` to override this check." ) else: - await ctx.send(f":x: Nominations must be run in the <#{Channels.nominations}> channel") + await ctx.send(f":x: Nominations must be run in the <#{Channels.nominations}> channel.") return await self._nominate_user(ctx, user, reason) @@ -256,11 +256,11 @@ class TalentPool(Cog, name="Talentpool"): return if not await self.refresh_cache(): - await ctx.send(f":x: Failed to update the cache; can't add {user}") + await ctx.send(f":x: Failed to update the cache; can't add {user.mention}.") return if len(reason) > REASON_MAX_CHARS: - await ctx.send(f":x: Maximum allowed characters for the reason is {REASON_MAX_CHARS}.") + await ctx.send(f":x: The reason's length must not exceed {REASON_MAX_CHARS} characters.") return # Manual request with `raise_for_status` as False because we want the actual response @@ -279,9 +279,9 @@ class TalentPool(Cog, name="Talentpool"): if resp.status == 400: if response_data.get('user', False): - await ctx.send(":x: The specified user can't be found in the database tables") + await ctx.send(f":x: {user.mention} can't be found in the database tables.") elif response_data.get('actor', False): - await ctx.send(":x: You have already nominated this user") + await ctx.send(f":x: You have already nominated {user.mention}.") return else: @@ -292,9 +292,7 @@ class TalentPool(Cog, name="Talentpool"): if await self.autoreview_enabled() and user.id not in self.reviewer: self.reviewer.schedule_review(user.id) - msg = f"✅ The nomination for {user.mention} has been added to the talent pool" - - await ctx.send(msg) + await ctx.send(f"✅ The nomination for {user.mention} has been added to the talent pool.") @nomination_group.command(name='history', aliases=('info', 'search')) @has_any_role(*MODERATION_ROLES) @@ -308,7 +306,7 @@ class TalentPool(Cog, name="Talentpool"): } ) if not result: - await ctx.send(":warning: This user has never been nominated") + await ctx.send(f":warning: {user.mention} has never been nominated.") return embed = Embed( @@ -334,13 +332,13 @@ class TalentPool(Cog, name="Talentpool"): Providing a `reason` is required. """ if len(reason) > REASON_MAX_CHARS: - await ctx.send(f":x: Maximum allowed characters for the end reason is {REASON_MAX_CHARS}.") + await ctx.send(f":x: The reason's length must not exceed {REASON_MAX_CHARS} characters.") return if await self.end_nomination(user.id, reason): - await ctx.send(f":white_check_mark: Successfully un-nominated {user}") + await ctx.send(f":white_check_mark: Successfully un-nominated {user.mention}.") else: - await ctx.send(":x: The specified user does not have an active nomination") + await ctx.send(f":x: {user.mention} doesn't have an active nomination.") @nomination_group.group(name='edit', aliases=('e',), invoke_without_command=True) @has_any_role(*STAFF_ROLES) @@ -375,7 +373,7 @@ class TalentPool(Cog, name="Talentpool"): if not any(role.id in MODERATION_ROLES for role in ctx.author.roles): if ctx.channel.id != Channels.nominations: - await ctx.send(f":x: Nomination edits must be run in the <#{Channels.nominations}> channel") + await ctx.send(f":x: Nomination edits must be run in the <#{Channels.nominations}> channel.") return if nominator != ctx.author or isinstance(nominee_or_nomination_id, int): @@ -402,7 +400,7 @@ class TalentPool(Cog, name="Talentpool"): ) -> None: """Edit a nomination reason in the database after validating the input.""" if len(reason) > REASON_MAX_CHARS: - await ctx.send(f":x: Maximum allowed characters for the reason is {REASON_MAX_CHARS}.") + await ctx.send(f":x: The reason's length must not exceed {REASON_MAX_CHARS} characters.") return if isinstance(target, int): nomination_id = target @@ -410,7 +408,7 @@ class TalentPool(Cog, name="Talentpool"): if nomination := self.cache.get(target.id): nomination_id = nomination["id"] else: - await ctx.send("No active nomination found for that member.") + await ctx.send(f":x: {target.mention} doesn't have an active nomination.") return try: @@ -418,13 +416,13 @@ class TalentPool(Cog, name="Talentpool"): except ResponseCodeError as e: if e.response.status == 404: log.trace(f"Nomination API 404: Can't find a nomination with id {nomination_id}") - await ctx.send(f":x: Can't find a nomination with id `{nomination_id}`") + await ctx.send(f":x: Can't find a nomination with id `{nomination_id}`.") return else: raise if not nomination["active"]: - await ctx.send(":x: Can't edit the reason of an inactive nomination.") + await ctx.send(f":x: <@{nomination['user']}> doesn't have an active nomination.") return if not any(entry["actor"] == actor.id for entry in nomination["entries"]): @@ -438,14 +436,14 @@ class TalentPool(Cog, name="Talentpool"): json={"actor": actor.id, "reason": reason} ) await self.refresh_cache() # Update cache - await ctx.send(":white_check_mark: Successfully updated nomination reason.") + await ctx.send(f":white_check_mark: Updated the nomination reason for <@{nomination['user']}>.") @nomination_edit_group.command(name='end_reason') @has_any_role(*MODERATION_ROLES) async def edit_end_reason_command(self, ctx: Context, nomination_id: int, *, reason: str) -> None: """Edits the unnominate reason for the nomination with the given `id`.""" if len(reason) > REASON_MAX_CHARS: - await ctx.send(f":x: Maximum allowed characters for the end reason is {REASON_MAX_CHARS}.") + await ctx.send(f":x: The reason's length must not exceed {REASON_MAX_CHARS} characters.") return try: @@ -453,13 +451,15 @@ class TalentPool(Cog, name="Talentpool"): except ResponseCodeError as e: if e.response.status == 404: log.trace(f"Nomination API 404: Can't find a nomination with id {nomination_id}") - await ctx.send(f":x: Can't find a nomination with id `{nomination_id}`") + await ctx.send(f":x: Can't find a nomination with id `{nomination_id}`.") return else: raise if nomination["active"]: - await ctx.send(":x: Can't edit the end reason of an active nomination.") + await ctx.send( + f":x: Can't edit the nomination end reason for <@{nomination['user']}> because it's still active." + ) return log.trace(f"Changing end reason for nomination with id {nomination_id} to {repr(reason)}") @@ -469,7 +469,7 @@ class TalentPool(Cog, name="Talentpool"): json={"end_reason": reason} ) await self.refresh_cache() # Update cache. - await ctx.send(":white_check_mark: Updated the end reason of the nomination!") + await ctx.send(f":white_check_mark: Updated the nomination end reason for <@{nomination['user']}>.") @nomination_group.command(aliases=('mr',)) @has_any_role(*MODERATION_ROLES) |