From 806b25d64e03ea94dc1d535777b1685edf8740af Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Mon, 5 May 2025 19:57:31 -0400 Subject: [PATCH 1/2] Better message on factoid delete --- techsupport_bot/commands/factoids.py | 30 ++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/techsupport_bot/commands/factoids.py b/techsupport_bot/commands/factoids.py index 07ac00e7..7e8f044d 100644 --- a/techsupport_bot/commands/factoids.py +++ b/techsupport_bot/commands/factoids.py @@ -733,13 +733,23 @@ async def delete_factoid( factoid = await self.get_raw_factoid_entry( called_factoid.factoid_db_entry.name, str(ctx.guild.id) ) + aliases_list = await self.get_list_of_aliases( + called_factoid.factoid_db_entry.name, str(ctx.guild.id) + ) + aliases_list.remove(called_factoid.original_call_str) + print_aliases_list = ", ".join(aliases_list) + + send_message = ( + f"This will remove the factoid `{called_factoid.original_call_str}`" + ) + if print_aliases_list: + send_message += f" and all of it's aliases `({print_aliases_list})` forever" + + send_message += ". Are you sure?" view = ui.Confirm() await view.send( - message=( - f"This will remove the factoid `{called_factoid.original_call_str}` " - "and all of it's aliases forever. Are you sure?" - ), + message=send_message, channel=ctx.channel, author=ctx.author, ) @@ -758,13 +768,13 @@ async def delete_factoid( await self.delete_factoid_call(factoid, str(ctx.guild.id)) # Don't send the confirmation message if this is an alias either - await auxiliary.send_confirm_embed( - ( - f"Successfully deleted the factoid `{called_factoid.original_call_str}`" - "and all of it's aliases" - ), - channel=ctx.channel, + confirm_message = ( + f"Successfully deleted the factoid `{called_factoid.original_call_str}`" ) + if print_aliases_list: + confirm_message += f" and all of it's aliases `({print_aliases_list})`" + + await auxiliary.send_confirm_embed(message=confirm_message, channel=ctx.channel) return True # -- Getting and responding with a factoid -- From e3db22935d86ffaa0115d845c57e3c49959b22e1 Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Sat, 17 May 2025 14:31:04 -0400 Subject: [PATCH 2/2] Remove typing --- techsupport_bot/commands/factoids.py | 1 - 1 file changed, 1 deletion(-) diff --git a/techsupport_bot/commands/factoids.py b/techsupport_bot/commands/factoids.py index 7e8f044d..1af87ed6 100644 --- a/techsupport_bot/commands/factoids.py +++ b/techsupport_bot/commands/factoids.py @@ -1256,7 +1256,6 @@ async def remember( alias=None, ) - @auxiliary.with_typing @commands.check(has_manage_factoids_role) @commands.guild_only() @factoid.command(