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

@@ -98,13 +98,13 @@ in various ways:
.. code-block:: python
@commands.command()
@checks.admin_or_permissions(manage_guild=True)
@commands.admin_or_permissions(manage_guild=True)
async def setbaz(self, ctx, new_value):
await self.config.guild(ctx.guild).baz.set(new_value)
await ctx.send("Value of baz has been changed!")
@commands.command()
@checks.is_owner()
@commands.is_owner()
async def setfoobar(self, ctx, new_value):
await self.config.foobar.set(new_value)
@@ -259,7 +259,7 @@ Now let's see an example that uses multiple identifiers:
.. code-block:: python
from redbot.core import Config, commands, checks
from redbot.core import Config, commands
class ChannelAccess(commands.Cog):
@@ -273,7 +273,7 @@ Now let's see an example that uses multiple identifiers:
self.config.register_custom("ChannelAccess", **default_access)
@commands.command()
@checks.is_owner()
@commands.is_owner()
async def grantaccess(self, ctx, channel: discord.TextChannel, member: discord.Member):
await self.config.custom("ChannelAccess", channel.id, member.id).allowed.set(True)
await ctx.send("Member has been granted access to that channel")