Use the commands module instead of checks for permission decorators (#5463)

Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>
This commit is contained in:
Kreusada
2023-04-13 19:16:12 +01:00
committed by GitHub
parent a70f444255
commit 79d11e947c
35 changed files with 238 additions and 249 deletions

View File

@@ -3,7 +3,7 @@ import logging
from typing import Tuple, Union
import discord
from redbot.core import Config, checks, commands
from redbot.core import Config, commands
from redbot.core.i18n import Translator, cog_i18n
from redbot.core.utils.chat_formatting import box
from redbot.core.utils.mod import get_audit_reason
@@ -215,7 +215,7 @@ class Admin(commands.Cog):
@commands.command()
@commands.guild_only()
@checks.admin_or_permissions(manage_roles=True)
@commands.admin_or_permissions(manage_roles=True)
async def addrole(
self,
ctx: commands.Context,
@@ -233,7 +233,7 @@ class Admin(commands.Cog):
@commands.command()
@commands.guild_only()
@checks.admin_or_permissions(manage_roles=True)
@commands.admin_or_permissions(manage_roles=True)
async def removerole(
self,
ctx: commands.Context,
@@ -251,7 +251,7 @@ class Admin(commands.Cog):
@commands.group()
@commands.guild_only()
@checks.admin_or_permissions(manage_roles=True)
@commands.admin_or_permissions(manage_roles=True)
async def editrole(self, ctx: commands.Context):
"""Edit role settings."""
pass
@@ -325,7 +325,7 @@ class Admin(commands.Cog):
await ctx.send(_("Done."))
@commands.group(invoke_without_command=True)
@checks.is_owner()
@commands.is_owner()
async def announce(self, ctx: commands.Context, *, message: str):
"""Announce a message to all servers the bot is in."""
if not self.is_announcing():
@@ -350,7 +350,7 @@ class Admin(commands.Cog):
@commands.group()
@commands.guild_only()
@checks.guildowner_or_permissions(administrator=True)
@commands.guildowner_or_permissions(administrator=True)
async def announceset(self, ctx):
"""Change how announcements are sent in this guild."""
pass
@@ -441,7 +441,7 @@ class Admin(commands.Cog):
await ctx.send(box(msg, "diff"))
@commands.group()
@checks.admin_or_permissions(manage_roles=True)
@commands.admin_or_permissions(manage_roles=True)
async def selfroleset(self, ctx: commands.Context):
"""Manage selfroles."""
pass
@@ -541,7 +541,7 @@ class Admin(commands.Cog):
await ctx.send(_("No changes have been made."))
@commands.command()
@checks.is_owner()
@commands.is_owner()
async def serverlock(self, ctx: commands.Context):
"""Lock a bot to its current servers only."""
serverlocked = await self.config.serverlocked()