Skip to content

Commit 323db71

Browse files
committed
Add docs on @slash.permission decorator.
1 parent a650d65 commit 323db71

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/gettingstarted.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,22 @@ role with id ``99999999`` and disallowing user with id ``88888888`` from running
293293
async def test(ctx):
294294
await ctx.send(content="Hello World!")
295295
296+
Alternatively you can use the ``@slash.permission`` decorator to define your guild permissions for the command.
297+
298+
.. code-block:: python
299+
300+
from discord_slash.utils.manage_commands import create_permission
301+
from discord_slash.model import SubcommandApplicationPermissionType
302+
303+
@slash.slash(name="test",
304+
description="This is just a test command, nothing more.")
305+
@slash.permission(guild_id = 12345678,
306+
permission = [
307+
create_permission(99999999, SlashCommandPermissionType.ROLE, True),
308+
create_permission(88888888, SlashCommandPermissionType.USER, False)
309+
])
310+
async def test(ctx):
311+
await ctx.send(content="Hello World!")
296312
297313
.. _quickstart: https://discord-py-slash-command.readthedocs.io/en/latest/quickstart.html
298314
.. _ApplicationCommandOptionType: https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptiontype

0 commit comments

Comments
 (0)