Skip to content

Commit 2faeae4

Browse files
authored
Merge branch 'development' into users/martinbndr/auto-close
2 parents aaf2fc7 + ab458f5 commit 2faeae4

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

cogs/utility.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ async def alias_raw(self, ctx, *, name: str.lower):
11481148

11491149
return await ctx.send(embed=embed)
11501150

1151-
async def make_alias(self, name, value, action):
1151+
async def make_alias(self, name, value, action, ctx):
11521152
values = utils.parse_alias(value)
11531153
if not values:
11541154
embed = discord.Embed(
@@ -1195,16 +1195,23 @@ async def make_alias(self, name, value, action):
11951195
if multiple_alias:
11961196
embed.description = (
11971197
"The command you are attempting to point "
1198-
f"to does not exist: `{linked_command}`."
1198+
f"to on step {i} does not exist: `{linked_command}`."
11991199
)
12001200
else:
12011201
embed.description = (
12021202
"The command you are attempting to point "
1203-
f"to on step {i} does not exist: `{linked_command}`."
1203+
f"to does not exist: `{linked_command}`."
12041204
)
12051205

12061206
return embed
12071207
else:
1208+
if linked_command == "eval" and not await checks.check_permissions(ctx, "eval"):
1209+
embed = discord.Embed(
1210+
title="Error",
1211+
description="You can only add the `eval` command to an alias if you have permissions for that command.",
1212+
color=self.bot.error_color,
1213+
)
1214+
return embed
12081215
save_aliases.append(val)
12091216
if multiple_alias:
12101217
embed.add_field(name=f"Step {i}:", value=utils.truncate(val, 1024))
@@ -1259,7 +1266,7 @@ async def alias_add(self, ctx, name: str.lower, *, value):
12591266
)
12601267

12611268
if embed is None:
1262-
embed = await self.make_alias(name, value, "Added")
1269+
embed = await self.make_alias(name, value, "Added", ctx)
12631270
return await ctx.send(embed=embed)
12641271

12651272
@alias.command(name="remove", aliases=["del", "delete"])
@@ -1291,7 +1298,7 @@ async def alias_edit(self, ctx, name: str.lower, *, value):
12911298
embed = utils.create_not_found_embed(name, self.bot.aliases.keys(), "Alias")
12921299
return await ctx.send(embed=embed)
12931300

1294-
embed = await self.make_alias(name, value, "Edited")
1301+
embed = await self.make_alias(name, value, "Edited", ctx)
12951302
return await ctx.send(embed=embed)
12961303

12971304
@alias.command(name="rename")

0 commit comments

Comments
 (0)