mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
Added permission constants
This commit is contained in:
53
docs/docs_permissionconstants.rst
Normal file
53
docs/docs_permissionconstants.rst
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
.. include:: ./vars.rst
|
||||||
|
|
||||||
|
Permission Constants
|
||||||
|
====================
|
||||||
|
|
||||||
|
In discord.js, you can handle permissions in two ways. The preferred way is to just use the string name of the permission, alternatively you can use ``Discord.Constants.Permissions["permission name"]``.
|
||||||
|
|
||||||
|
Valid Permission Names
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
.. code-block:: js
|
||||||
|
|
||||||
|
{
|
||||||
|
// general
|
||||||
|
createInstantInvite,
|
||||||
|
kickMembers,
|
||||||
|
banMembers,
|
||||||
|
manageRoles,
|
||||||
|
managePermissions,
|
||||||
|
manageChannels,
|
||||||
|
manageChannel,
|
||||||
|
manageServer,
|
||||||
|
// text
|
||||||
|
readMessages,
|
||||||
|
sendMessages,
|
||||||
|
sendTTSMessages,
|
||||||
|
manageMessages,
|
||||||
|
embedLinks,
|
||||||
|
attachFiles,
|
||||||
|
readMessageHistory,
|
||||||
|
mentionEveryone,
|
||||||
|
// voice
|
||||||
|
voiceConnect,
|
||||||
|
voiceSpeak,
|
||||||
|
voiceMuteMembers,
|
||||||
|
voiceDeafenMembers,
|
||||||
|
voiceMoveMembers,
|
||||||
|
voiceUseVAD
|
||||||
|
};
|
||||||
|
|
||||||
|
Preferred Way
|
||||||
|
-------------
|
||||||
|
|
||||||
|
The preferred way of using permissions in discord.js is to just use the name. E.g:
|
||||||
|
|
||||||
|
``role.hasPermission("voiceUseVAD")``
|
||||||
|
|
||||||
|
Alternative
|
||||||
|
-----------
|
||||||
|
|
||||||
|
You can also go the long way round and use the numerical permission like so:
|
||||||
|
|
||||||
|
``role.hasPermission( Discord.Constants.Permissions.voiceUseVAD )``
|
||||||
@@ -20,7 +20,7 @@ Contents:
|
|||||||
.. _docs:
|
.. _docs:
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 1
|
||||||
:caption: Channel Documentation
|
:caption: Channel Documentation
|
||||||
|
|
||||||
docs_channel
|
docs_channel
|
||||||
@@ -30,7 +30,7 @@ Contents:
|
|||||||
docs_voicechannel
|
docs_voicechannel
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 1
|
||||||
:caption: Documentation
|
:caption: Documentation
|
||||||
|
|
||||||
docs_client
|
docs_client
|
||||||
@@ -40,15 +40,16 @@ Contents:
|
|||||||
docs_invite
|
docs_invite
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 1
|
||||||
:caption: Permission Documentation
|
:caption: Permission Documentation
|
||||||
|
|
||||||
|
docs_permissionconstants
|
||||||
docs_role
|
docs_role
|
||||||
docs_permissionoverwrite
|
docs_permissionoverwrite
|
||||||
docs_channelpermissions
|
docs_channelpermissions
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 1
|
||||||
:caption: Util Documentation
|
:caption: Util Documentation
|
||||||
|
|
||||||
docs_cache
|
docs_cache
|
||||||
|
|||||||
@@ -13,5 +13,6 @@
|
|||||||
.. _Role : ./docs_role.html
|
.. _Role : ./docs_role.html
|
||||||
.. _ChannelPermissions : ./docs_channelpermissions.html
|
.. _ChannelPermissions : ./docs_channelpermissions.html
|
||||||
.. _PermissionOverwrite : ./docs_permissionoverwrite.html
|
.. _PermissionOverwrite : ./docs_permissionoverwrite.html
|
||||||
|
.. _Permission Constants : ./docs_permissionconstants.html
|
||||||
.. _Promises : https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
.. _Promises : https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
||||||
.. _EventEmitter : https://nodejs.org/api/events.html#events_class_events_eventemitter
|
.. _EventEmitter : https://nodejs.org/api/events.html#events_class_events_eventemitter
|
||||||
Reference in New Issue
Block a user