From f4e635a5558b137be5f61fc0a528d1205463eff2 Mon Sep 17 00:00:00 2001 From: Shom770 <82843611+Shom770@users.noreply.github.com> Date: Fri, 7 Jan 2022 17:13:00 -0500 Subject: changing vague parts of the talentpool to the user specified for clarity --- bot/exts/recruitment/talentpool/_cog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/exts/recruitment/talentpool/_cog.py b/bot/exts/recruitment/talentpool/_cog.py index 8fa0be5b1..de4c43b0e 100644 --- a/bot/exts/recruitment/talentpool/_cog.py +++ b/bot/exts/recruitment/talentpool/_cog.py @@ -281,7 +281,7 @@ class TalentPool(Cog, name="Talentpool"): if response_data.get('user', False): await ctx.send(":x: The specified user 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: @@ -438,7 +438,7 @@ 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: Successfully updated nomination reason for {actor.mention}") @nomination_edit_group.command(name='end_reason') @has_any_role(*MODERATION_ROLES) -- cgit v1.2.3 From 341e38739eb284d16597957162787d64ae579f87 Mon Sep 17 00:00:00 2001 From: Shom770 <82843611+Shom770@users.noreply.github.com> Date: Fri, 7 Jan 2022 19:30:11 -0500 Subject: using target instead of actor --- bot/exts/recruitment/talentpool/_cog.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bot/exts/recruitment/talentpool/_cog.py b/bot/exts/recruitment/talentpool/_cog.py index de4c43b0e..f76713fae 100644 --- a/bot/exts/recruitment/talentpool/_cog.py +++ b/bot/exts/recruitment/talentpool/_cog.py @@ -406,9 +406,11 @@ class TalentPool(Cog, name="Talentpool"): return if isinstance(target, int): nomination_id = target + target_mention = (await self.bot.fetch_user(target)).mention else: if nomination := self.cache.get(target.id): nomination_id = nomination["id"] + target_mention = target.mention else: await ctx.send("No active nomination found for that member.") return @@ -438,7 +440,7 @@ class TalentPool(Cog, name="Talentpool"): json={"actor": actor.id, "reason": reason} ) await self.refresh_cache() # Update cache - await ctx.send(f":white_check_mark: Successfully updated nomination reason for {actor.mention}") + await ctx.send(f":white_check_mark: Successfully updated nomination reason for {target_mention}") @nomination_edit_group.command(name='end_reason') @has_any_role(*MODERATION_ROLES) -- cgit v1.2.3 From 858f951b12904795a97dbde04915ad60eddc2084 Mon Sep 17 00:00:00 2001 From: Shom770 <82843611+Shom770@users.noreply.github.com> Date: Sat, 8 Jan 2022 17:10:30 -0500 Subject: user mention for editing reason works now presumed that when target was an integer, it would be the user ID and not the nomination ID. retrieves user from nomination and fetches the user --- bot/exts/recruitment/talentpool/_cog.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bot/exts/recruitment/talentpool/_cog.py b/bot/exts/recruitment/talentpool/_cog.py index f76713fae..bbb3196a1 100644 --- a/bot/exts/recruitment/talentpool/_cog.py +++ b/bot/exts/recruitment/talentpool/_cog.py @@ -406,11 +406,9 @@ class TalentPool(Cog, name="Talentpool"): return if isinstance(target, int): nomination_id = target - target_mention = (await self.bot.fetch_user(target)).mention else: if nomination := self.cache.get(target.id): nomination_id = nomination["id"] - target_mention = target.mention else: await ctx.send("No active nomination found for that member.") return @@ -440,7 +438,10 @@ class TalentPool(Cog, name="Talentpool"): json={"actor": actor.id, "reason": reason} ) await self.refresh_cache() # Update cache - await ctx.send(f":white_check_mark: Successfully updated nomination reason for {target_mention}") + await ctx.send( + f":white_check_mark: Successfully updated nomination reason" + f" for {(await self.bot.fetch_user(nomination['user'])).mention}" + ) @nomination_edit_group.command(name='end_reason') @has_any_role(*MODERATION_ROLES) -- cgit v1.2.3 From 351a5ffe2ef259ae98937a251c4c89ca8d46104f Mon Sep 17 00:00:00 2001 From: Shom770 <82843611+Shom770@users.noreply.github.com> Date: Sun, 9 Jan 2022 15:46:20 -0500 Subject: unnecessary fetching of user --- bot/exts/recruitment/talentpool/_cog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/recruitment/talentpool/_cog.py b/bot/exts/recruitment/talentpool/_cog.py index bbb3196a1..28df8df11 100644 --- a/bot/exts/recruitment/talentpool/_cog.py +++ b/bot/exts/recruitment/talentpool/_cog.py @@ -440,7 +440,7 @@ class TalentPool(Cog, name="Talentpool"): await self.refresh_cache() # Update cache await ctx.send( f":white_check_mark: Successfully updated nomination reason" - f" for {(await self.bot.fetch_user(nomination['user'])).mention}" + f" for <@{nomination['user']}>" ) @nomination_edit_group.command(name='end_reason') -- cgit v1.2.3 From 3f0e671c518c306b413a9a7b79b6eecbad090b1b Mon Sep 17 00:00:00 2001 From: Mark <1515135+MarkKoz@users.noreply.github.com> Date: Wed, 8 Jun 2022 16:06:04 -0700 Subject: Improve nomination message consistency and include user mentions --- bot/exts/recruitment/talentpool/_cog.py | 59 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/bot/exts/recruitment/talentpool/_cog.py b/bot/exts/recruitment/talentpool/_cog.py index 28df8df11..51f9de238 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 ` 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"): "Use `!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: Maxiumum 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(f":x: You have already nominated {user.mention}") + 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,17 +436,14 @@ class TalentPool(Cog, name="Talentpool"): json={"actor": actor.id, "reason": reason} ) await self.refresh_cache() # Update cache - await ctx.send( - f":white_check_mark: Successfully updated nomination reason" - f" for <@{nomination['user']}>" - ) + 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: Maxiumum 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: @@ -456,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)}") @@ -472,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) -- cgit v1.2.3