Added permission constants

This commit is contained in:
hydrabolt
2015-11-20 21:42:03 +00:00
parent c5f81298f9
commit b38c63f855
3 changed files with 59 additions and 4 deletions

View 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 )``

View File

@@ -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

View File

@@ -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