mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23: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:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:maxdepth: 1
|
||||
:caption: Channel Documentation
|
||||
|
||||
docs_channel
|
||||
@@ -30,7 +30,7 @@ Contents:
|
||||
docs_voicechannel
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:maxdepth: 1
|
||||
:caption: Documentation
|
||||
|
||||
docs_client
|
||||
@@ -40,15 +40,16 @@ Contents:
|
||||
docs_invite
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:maxdepth: 1
|
||||
:caption: Permission Documentation
|
||||
|
||||
docs_permissionconstants
|
||||
docs_role
|
||||
docs_permissionoverwrite
|
||||
docs_channelpermissions
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:maxdepth: 1
|
||||
:caption: Util Documentation
|
||||
|
||||
docs_cache
|
||||
|
||||
@@ -13,5 +13,6 @@
|
||||
.. _Role : ./docs_role.html
|
||||
.. _ChannelPermissions : ./docs_channelpermissions.html
|
||||
.. _PermissionOverwrite : ./docs_permissionoverwrite.html
|
||||
.. _Permission Constants : ./docs_permissionconstants.html
|
||||
.. _Promises : https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
||||
.. _EventEmitter : https://nodejs.org/api/events.html#events_class_events_eventemitter
|
||||
Reference in New Issue
Block a user