[V3 Alias] Add checks to alias add/del (#1676)

This commit is contained in:
Michael H 2018-05-22 19:27:11 -04:00 committed by Will
parent 28bc68c916
commit 77cdbf8dd6

View File

@ -3,7 +3,7 @@ from re import search
from typing import Generator, Tuple, Iterable
import discord
from redbot.core import Config, commands
from redbot.core import Config, commands, checks
from redbot.core.i18n import Translator, cog_i18n
from redbot.core.utils.chat_formatting import box
@ -185,6 +185,7 @@ class Alias:
if ctx.invoked_subcommand is None or isinstance(ctx.invoked_subcommand, commands.Group):
await ctx.send_help()
@checks.mod_or_permissions(manage_guild=True)
@alias.command(name="add")
@commands.guild_only()
async def _add_alias(self, ctx: commands.Context, alias_name: str, *, command):
@ -236,6 +237,7 @@ class Alias:
_("A new alias with the trigger `{}`" " has been created.").format(alias_name)
)
@checks.is_owner()
@global_.command(name="add")
async def _add_global_alias(self, ctx: commands.Context, alias_name: str, *, command):
"""
@ -312,6 +314,7 @@ class Alias:
else:
await ctx.send(_("There is no alias with the name `{}`").format(alias_name))
@checks.mod_or_permissions(manage_guild=True)
@alias.command(name="del")
@commands.guild_only()
async def _del_alias(self, ctx: commands.Context, alias_name: str):
@ -332,6 +335,7 @@ class Alias:
else:
await ctx.send(_("Alias with name `{}` was not found.").format(alias_name))
@checks.is_owner()
@global_.command(name="del")
async def _del_global_alias(self, ctx: commands.Context, alias_name: str):
"""