Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions techsupport_bot/commands/factoids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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 --
Expand Down Expand Up @@ -1246,7 +1256,6 @@ async def remember(
alias=None,
)

@auxiliary.with_typing
@commands.check(has_manage_factoids_role)
@commands.guild_only()
@factoid.command(
Expand Down
Loading