Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alias add improvements #3343

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
15 changes: 11 additions & 4 deletions cogs/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ async def alias_raw(self, ctx, *, name: str.lower):

return await ctx.send(embed=embed)

async def make_alias(self, name, value, action):
async def make_alias(self, name, value, action, ctx):
values = utils.parse_alias(value)
if not values:
embed = discord.Embed(
Expand Down Expand Up @@ -1083,16 +1083,23 @@ async def make_alias(self, name, value, action):
if multiple_alias:
embed.description = (
"The command you are attempting to point "
f"to does not exist: `{linked_command}`."
f"to on step {i} does not exist: `{linked_command}`."
)
else:
embed.description = (
"The command you are attempting to point "
f"to on step {i} does not exist: `{linked_command}`."
f"to does not exist: `{linked_command}`."
)

return embed
else:
if linked_command == "eval" and not await checks.check_permissions(ctx, "eval"):
embed = discord.Embed(
title="Error",
description="You can only add the `eval` command to an alias if you have permissions for that command.",
color=self.bot.error_color,
)
return embed
save_aliases.append(val)
if multiple_alias:
embed.add_field(name=f"Step {i}:", value=utils.truncate(val, 1024))
Expand Down Expand Up @@ -1147,7 +1154,7 @@ async def alias_add(self, ctx, name: str.lower, *, value):
)

if embed is None:
embed = await self.make_alias(name, value, "Added")
embed = await self.make_alias(name, value, "Added", ctx)
return await ctx.send(embed=embed)

@alias.command(name="remove", aliases=["del", "delete"])
Expand Down
Loading