Skip to content

Commit c725978

Browse files
committed
Update documentation.
1 parent 333b803 commit c725978

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

discord_slash/utils/manage_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def create_permission(id:int, id_type: int, permission: typing.Union[bool, Slash
320320
Create a single command permission.
321321
322322
:param id: Target id to apply the permission on.
323-
:param id_type: Type of the id.
323+
:param id_type: Type of the id, :class:`..model.SlashCommandPermissionsType`.
324324
:param permission: State of the permission. ``True`` to allow access, ``False to disallow access.
325325
:return: dict
326326
"""

docs/gettingstarted.rst

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ Want to restrict access? Setup permissions!
235235
Slash commands also supports ability to set permissions to allow only certain roles and/or users
236236
to run a slash command. Permissions can be applied to both global and guild based commands. They
237237
are defined per guild ,per top-level command (the base command for subcommands), and each guild can have multiple permissions. Here table that shows the JSON
238-
structure of how choices are represented for a single permission:
238+
structure of how permissions are represented:
239239

240240
+-------------+--------------------------------------------+-----------------------------------------------------------------------------------------------------+
241241
| **Field** | **Type** | **Description** |
@@ -280,27 +280,19 @@ role with id ``99999999`` and disallowing user with id ``88888888`` from running
280280
.. code-block:: python
281281
282282
from discord_slash.utils.manage_commands import create_permission
283+
from discord_slash.model import SubcommandApplicationPermissionType
283284
284285
@slash.slash(name="test",
285286
description="This is just a test command, nothing more.",
286287
permissions={
287288
12345678: [
288-
create_permission(99999999, 1, True),
289-
create_permission(88888888, 2, False)
289+
create_permission(99999999, SubcommandApplicationPermissionType.ROLE, True),
290+
create_permission(88888888, SubcommandApplicationPermissionType.USER, False)
290291
]
291292
})
292293
async def test(ctx):
293294
await ctx.send(content="Hello World!")
294295
295-
Additionally, we could also declare the id type of our permission through this method shown here:
296-
297-
.. code-block:: python
298-
299-
from discord_slash.model import SubcommandApplicationPermissionType
300-
301-
(...)
302-
303-
option_type=SubcommandApplicationPermissionType.ROLE
304296
305297
.. _quickstart: https://discord-py-slash-command.readthedocs.io/en/latest/quickstart.html
306298
.. _ApplicationCommandOptionType: https://discord.com/developers/docs/interactions/slash-commands#applicationcommandoptiontype

0 commit comments

Comments
 (0)