Make the checks in [p]alias global add and [p]alias add consistent (#3797)

This commit is contained in:
jack1142 2020-05-28 23:50:44 +02:00 committed by GitHub
parent 4757c2c945
commit 45afaa8ec8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,7 +157,7 @@ class Alias(commands.Cog):
_( _(
"You attempted to create a new alias" "You attempted to create a new alias"
" with the name {name} but that" " with the name {name} but that"
" alias already exists on this server." " alias already exists."
).format(name=alias_name) ).format(name=alias_name)
) )
return return
@ -210,13 +210,13 @@ class Alias(commands.Cog):
) )
return return
alias = await self._aliases.get_alias(ctx.guild, alias_name) alias = await self._aliases.get_alias(None, alias_name)
if alias: if alias:
await ctx.send( await ctx.send(
_( _(
"You attempted to create a new global alias" "You attempted to create a new global alias"
" with the name {name} but that" " with the name {name} but that"
" alias already exists on this server." " alias already exists."
).format(name=alias_name) ).format(name=alias_name)
) )
return return
@ -232,6 +232,13 @@ class Alias(commands.Cog):
).format(name=alias_name) ).format(name=alias_name)
) )
return return
given_command_exists = self.bot.get_command(command.split(maxsplit=1)[0]) is not None
if not given_command_exists:
await ctx.send(
_("You attempted to create a new alias for a command that doesn't exist.")
)
return
# endregion # endregion
try: try: