mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Cleaning for RTD theme and a bit of reorganization
This commit is contained in:
14
docs/conf.py
14
docs/conf.py
@@ -55,9 +55,9 @@ author = u'hydrabolt'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '4.1'
|
||||
version = '5.0'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '4.1.0'
|
||||
release = '5.0.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
@@ -137,7 +137,7 @@ html_theme = 'default'
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
#html_static_path = ['_static']
|
||||
|
||||
# Add any extra paths that contain custom files (such as robots.txt or
|
||||
# .htaccess) here, relative to this directory. These files are copied
|
||||
@@ -282,3 +282,11 @@ texinfo_documents = [
|
||||
|
||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||
#texinfo_no_detailmenu = False
|
||||
|
||||
if not os.environ.get('READTHEDOCS', None) == 'True':
|
||||
try:
|
||||
import sphinx_rtd_theme
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||
except ImportError:
|
||||
print("sphinx_rtd_theme not found! Do 'pip install sphinx_rtd_theme' to make local builds use the RTD theme.")
|
||||
@@ -7,7 +7,7 @@ Cache
|
||||
|
||||
A Cache object extends an Array (so it can be used like a regular array) but introduces helper functions to make it more useful when developing with discord.js. Unlike a regular array, it doesn't care about the instance or prototype of an object, it works purely on properties.
|
||||
|
||||
-----
|
||||
--------
|
||||
|
||||
Functions
|
||||
---------
|
||||
@@ -20,7 +20,7 @@ Returns a contained object where ``object[key] == value``. Returns the first obj
|
||||
getAll(key, value)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Similar to ``cache.get(key, value)``, but returns a Cache of any objects that meet the criteria.
|
||||
Similar to ``cache.get(key, value)``, but returns a Cache of any objects that meet the criteria.
|
||||
|
||||
has(key, value)
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -7,11 +7,11 @@ Channel
|
||||
|
||||
The Channel class is the base class for all types of channel.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
--------
|
||||
|
||||
id
|
||||
~~
|
||||
|
||||
|
||||
@@ -5,13 +5,11 @@ ChannelPermissions
|
||||
|
||||
ChannelPermissions is used to represent the final permissions of a user in a channel, to see exactly what they are and aren't allowed to do.
|
||||
|
||||
-----------
|
||||
--------
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
------------
|
||||
|
||||
serialize()
|
||||
~~~~~~~~~~~
|
||||
|
||||
@@ -25,7 +23,7 @@ Returns an object containing permission names and values. E.g:
|
||||
createInstantInvite : true,
|
||||
kickMembers : false
|
||||
}
|
||||
|
||||
|
||||
For more on valid permission names, see `Permission Constants`_.
|
||||
|
||||
hasPermission(permission)
|
||||
|
||||
@@ -7,11 +7,11 @@ Client
|
||||
|
||||
This page contains documentation on the `Discord.Client` class. This should be used when you want to start creating things with the API.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
--------
|
||||
|
||||
users
|
||||
~~~~~
|
||||
|
||||
@@ -59,24 +59,26 @@ Functions
|
||||
|
||||
.. note :: Any functions used here that take callbacks as an optional parameter can also be used as Promises_. Promises take the exact same parameters for each use case, except errors are moved to catch statements instead of then. For example, you can do:
|
||||
|
||||
.. code-block:: js
|
||||
.. code-block:: js
|
||||
|
||||
bot.login(email, password).then(success).catch(err);
|
||||
|
||||
function success(token){
|
||||
// handle success
|
||||
}
|
||||
|
||||
function err(error){
|
||||
// handle error
|
||||
}
|
||||
|
||||
or use callbacks:
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
bot.login(email, password, function(error, token){
|
||||
// handle error and success
|
||||
});
|
||||
|
||||
bot.login(email, password).then(success).catch(err);
|
||||
|
||||
function success(token){
|
||||
|
||||
}
|
||||
|
||||
function err(error){
|
||||
|
||||
}
|
||||
|
||||
// OR use callbacks:
|
||||
|
||||
bot.login(email, password, function(error, token){
|
||||
|
||||
});
|
||||
|
||||
login(email, password, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -85,9 +87,8 @@ Logs the client in so it can begin initialising. Use this `after` registering yo
|
||||
- **email** - The e-mail used to sign in, `String`.
|
||||
- **password** - The password used to sign in, `String`.
|
||||
- **callback** - `function` that takes the following parameters:
|
||||
|
||||
- **error** - An error if any occurred
|
||||
- **token** - The token received after logging in, `String`.
|
||||
- **error** - An error if any occurred
|
||||
- **token** - The token received after logging in, `String`.
|
||||
|
||||
logout(`callback`)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
@@ -95,9 +96,8 @@ logout(`callback`)
|
||||
Logs the client out and closes the WebSocket connections.
|
||||
|
||||
- **callback** - `function` that takes the following parameter:
|
||||
- **error** - An error if any occurred
|
||||
|
||||
- **error** - An error if any occurred
|
||||
|
||||
sendMessage(channel, content, `options`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -106,13 +106,11 @@ Sends a message to the specified channel.
|
||||
- **channel** - a `Channel Resolvable`_
|
||||
- **content** - a `String Resolvable`_ - the message you want to send
|
||||
- **options** - `object` containing:
|
||||
|
||||
- **tts** - `Boolean`, should message be text-to-speech
|
||||
- **tts** - `Boolean`, should message be text-to-speech
|
||||
- **callback** - `function` that takes the following parameters:
|
||||
- **error** - error object if any occurred
|
||||
- **message** - the sent Message_
|
||||
|
||||
- **error** - error object if any occurred
|
||||
- **message** - the sent Message_
|
||||
|
||||
sendFile(channel, attachment, name, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -122,10 +120,9 @@ Sends a file to the specified channel.
|
||||
- **attachment** - A ReadableStream, String or Buffer
|
||||
- **name** - `String`, name of the file containing the extension
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
- **message** - the sent Message_
|
||||
|
||||
- **error** - error if any occurred
|
||||
- **message** - the sent Message_
|
||||
|
||||
reply(message, content, `options`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -134,26 +131,11 @@ Shortcut to `sendMessage` but prepends a mention to the sender of the original m
|
||||
- **message** - The Message_ to reply to
|
||||
- **content** - a `String Resolvable`_ - the message you want to send
|
||||
- **options** - `object` containing:
|
||||
|
||||
- **tts** - `Boolean`, should message be text-to-speech
|
||||
- **tts** - `Boolean`, should message be text-to-speech
|
||||
- **callback** - `function` that takes the following parameters:
|
||||
- **error** - error object if any occurred
|
||||
- **message** - the sent Message_
|
||||
|
||||
- **error** - error object if any occurred
|
||||
- **message** - the sent Message_
|
||||
|
||||
deleteMessage(message, `options`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Attempts to delete a message
|
||||
|
||||
- **message** - The Message_ to delete
|
||||
- **options** - `object` containing the following:
|
||||
|
||||
- **wait** - Milliseconds as a `number` to wait before deleting the message
|
||||
- **callback**
|
||||
|
||||
- **error** - error object if any occurred
|
||||
|
||||
updateMessage(message, content, `options`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -162,13 +144,22 @@ Updates the content of a previously sent message
|
||||
- **message** - The Message_ to update
|
||||
- **content** - a `String Resolvable`_ - the content you want to update the message with
|
||||
- **options** - `object` containing:
|
||||
|
||||
- **tts** - `Boolean`, should message be text-to-speech
|
||||
- **tts** - `Boolean`, should message be text-to-speech
|
||||
- **callback** - `function` that takes the following parameters:
|
||||
- **error** - error object if any occurred
|
||||
- **message** - the sent Message_
|
||||
|
||||
deleteMessage(message, `options`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Attempts to delete a message
|
||||
|
||||
- **message** - The Message_ to delete
|
||||
- **options** - `object` containing the following:
|
||||
- **wait** - Milliseconds as a `number` to wait before deleting the message
|
||||
- **callback**
|
||||
- **error** - error object if any occurred
|
||||
|
||||
- **error** - error object if any occurred
|
||||
- **message** - the sent Message_
|
||||
|
||||
getChannelLogs(channel, `limit`, `options`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -177,14 +168,12 @@ Gets a list of previously sent messages in a channel.
|
||||
- **channel** - The Channel_ to get messages from
|
||||
- **limit** - The maximum amount of messages to retrieve - defaults to 500. A `Number`
|
||||
- **options** - An `object` containing either of the following:
|
||||
|
||||
- **before** - A `Message Resolvable`_ - gets messages before this message.
|
||||
- **after** - A `Message Resolvable`_ - gets messages after this message.
|
||||
- **before** - A `Message Resolvable`_ - gets messages before this message.
|
||||
- **after** - A `Message Resolvable`_ - gets messages after this message.
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
- **messages** - `array` of Message_ objects sent in channel
|
||||
|
||||
- **error** - error if any occurred
|
||||
- **messages** - `array` of Message_ objects sent in channel
|
||||
|
||||
getBans(server, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -192,10 +181,9 @@ Gets a list of banned users in a server.
|
||||
|
||||
- **server** - `Server Resolvable`_ - The server to get banned users of
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
- **users** - `array` of banned users in the server
|
||||
|
||||
- **error** - error if any occurred
|
||||
- **users** - `array` of banned users in the server
|
||||
|
||||
joinServer(invite, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -203,10 +191,9 @@ Joins a server from the given invite
|
||||
|
||||
- **invite** - an `Invite Resolvable`_
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
- **server** - the joined Server_
|
||||
|
||||
- **error** - error if any occurred
|
||||
- **server** - the joined Server_
|
||||
|
||||
createServer(name, region, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -215,10 +202,9 @@ Creates a server
|
||||
- **name** - `String`, name of the server
|
||||
- **region** - `String`, region of the server, currently **us-west, us-east, singapore, london, sydney** or **amsterdam**
|
||||
- **callback** - `function` taking the following:
|
||||
|
||||
- **error** - error if any occurred
|
||||
- **server** - the created Server_
|
||||
|
||||
- **error** - error if any occurred
|
||||
- **server** - the created Server_
|
||||
|
||||
leaveServer(server, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -226,9 +212,8 @@ Leaves/deletes a server that the client is in
|
||||
|
||||
- **server** - a `Server Resolvable`_
|
||||
- **callback** - `function` taking the following:
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
createChannel(server, name, `type`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -238,10 +223,9 @@ Creates a channel in a server
|
||||
- **name** - `String`, name of the channel. Spaces not allowed.
|
||||
- **type** - defaults to `text`, but can also be `voice`
|
||||
- **callback** - `function` taking the following:
|
||||
|
||||
- **error** - error if any occurred
|
||||
- **channel** - the created ServerChannel_
|
||||
|
||||
- **error** - error if any occurred
|
||||
- **channel** - the created ServerChannel_
|
||||
|
||||
deleteChannel(channel, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -249,9 +233,8 @@ Deletes a channel in a server.
|
||||
|
||||
- **channel** - a `Channel Resolvable`_ to delete
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred.
|
||||
|
||||
- **error** - error if any occurred.
|
||||
|
||||
banMember(user, server, `length`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -261,9 +244,8 @@ Bans a user from a server.
|
||||
- **server** - A `Server Resolvable`_ to ban the user from
|
||||
- **length** - `Number`, how many days to go back and delete messages from that user
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred.
|
||||
|
||||
- **error** - error if any occurred.
|
||||
|
||||
unbanMember(user, server, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -272,9 +254,8 @@ Unbans a user from a server.
|
||||
- **user** - A `User Resolvable`_ to unban
|
||||
- **server** - A `Server Resolvable`_ to unban the user from
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred.
|
||||
|
||||
- **error** - error if any occurred.
|
||||
|
||||
kickMember(user, server, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -283,9 +264,8 @@ Removes a user from a server
|
||||
- **user** - A `User Resolvable`_ to kick
|
||||
- **server** - A `Server Resolvable`_ to kick the user from
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred.
|
||||
|
||||
- **error** - error if any occurred.
|
||||
|
||||
createInvite(channel, `options`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -293,16 +273,23 @@ Creates an invite for the specified channel (or server)
|
||||
|
||||
- **channel** - A `Channel Resolvable`_
|
||||
- **options** - `object` containing:
|
||||
|
||||
- **maxAge** - `Number` for maximum time in seconds for invite's validity
|
||||
- **maxUses** - `Number`, maximum uses of invite
|
||||
- **temporary** - `Boolean`, whether the invite should be temporary
|
||||
- **xkcd** - `Boolean`, whether the invite should be human-readable-friendly.
|
||||
- **maxAge** - `Number` for maximum time in seconds for invite's validity
|
||||
- **maxUses** - `Number`, maximum uses of invite
|
||||
- **temporary** - `Boolean`, whether the invite should be temporary
|
||||
- **xkcd** - `Boolean`, whether the invite should be human-readable-friendly.
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
- **invite** - the created Invite_
|
||||
|
||||
deleteInvite(invite, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Deletes an invite
|
||||
|
||||
- **invite** - An `Invite ID Resolvable`_
|
||||
- **callback** - a `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
- **error** - error if any occurred
|
||||
- **invite** - the created Invite_
|
||||
|
||||
setStatus(status, `game`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -311,9 +298,8 @@ Sets the Discord Status of the Client
|
||||
- **status** - `String`, either `online` or `idle`
|
||||
- **game** - `String/Number`, ID of Discord Game being played
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
setTopic(channel, topic, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -322,9 +308,8 @@ Sets the topic of a channel
|
||||
- **channel** - A `Channel Resolvable`_
|
||||
- **topic** - A `String`
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
setChannelName(channel, name, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -333,9 +318,8 @@ Sets the name of a channel
|
||||
- **channel** - A `Channel Resolvable`_
|
||||
- **name** - A `String`
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
setChannelNameAndTopic(channel, name, topic, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -345,8 +329,7 @@ Sets the name and topic of a channel
|
||||
- **name** - A `String`
|
||||
- **topic** - A `String`
|
||||
- **callback** - `function` taking the following:
|
||||
|
||||
- **error** - error if any occurred
|
||||
- **error** - error if any occurred
|
||||
|
||||
startTyping(channel, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -355,9 +338,8 @@ Marks the client as typing in a channel.
|
||||
|
||||
- **channel** - A `Channel Resolvable`_
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
stopTyping(channel, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -365,24 +347,21 @@ Marks the client as not typing in a channel (takes a few seconds to go active).
|
||||
|
||||
- **channel** - A `Channel Resolvable`_
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
updateDetails(details, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Updates the details of the client
|
||||
|
||||
- **details** - `object` containing any of the following:
|
||||
|
||||
- **avatar** - `Base64 Resolvable`_, new avatar of the client
|
||||
- **email** - `String`, new email of the client
|
||||
- **newPassword** - `String`, new password of the client
|
||||
- **username** - `String`, new username of the client
|
||||
- **avatar** - `Base64 Resolvable`_, new avatar of the client
|
||||
- **email** - `String`, new email of the client
|
||||
- **newPassword** - `String`, new password of the client
|
||||
- **username** - `String`, new username of the client
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
setAvatar(avatar, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -390,9 +369,8 @@ Sets the avatar of the client
|
||||
|
||||
- **avatar** - `Base64 Resolvable`_, new avatar of the client
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
setUsername(name, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -400,9 +378,8 @@ Sets the username of the client
|
||||
|
||||
- **username** - `String`, new username of the Client
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
joinVoiceChannel(channel, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -410,18 +387,16 @@ Joins a Voice Channel to begin transmitting audio
|
||||
|
||||
- **channel** - A `VoiceChannel Resolvable`_
|
||||
- **callback** - `function` that takes the following:
|
||||
- **error** - error if any occurred
|
||||
- **connection** - VoiceConnection_, the created Voice Connection.
|
||||
|
||||
- **error** - error if any occurred
|
||||
- **connection** - VoiceConnection_, the created Voice Connection.
|
||||
|
||||
leaveVoiceChannel(`callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Leaves the currently connected Voice Channel if connected
|
||||
|
||||
- **callback** - `function` that takes the following:
|
||||
|
||||
- **error** - error if any occurred
|
||||
- **error** - error if any occurred
|
||||
|
||||
createRole(server, `data`, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -431,24 +406,46 @@ Creates a new role in a server.
|
||||
- **server** - a `Server Resolvable`_
|
||||
- **data** - `object` containing the structure below
|
||||
- **callback** - `function` that takes the following:
|
||||
- **error** - error if any occurred
|
||||
- **role** - the created Role_
|
||||
|
||||
- **error** - error if any occurred
|
||||
- **role** - the created Role_
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
// structure of data parameter (all attrs optional):
|
||||
|
||||
{
|
||||
color : 0xFF0000,
|
||||
hoist : false,
|
||||
name : "A New Role!",
|
||||
permissions : [
|
||||
// see the constants documentation for full permissions
|
||||
"attachFiles", "sendMessages"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
// structure of data parameter (all attrs optional):
|
||||
{
|
||||
color : 0xFF0000,
|
||||
hoist : false,
|
||||
name : "A New Role!",
|
||||
permissions : [
|
||||
// see the constants documentation for full permissions
|
||||
"attachFiles", "sendMessages"
|
||||
]
|
||||
}
|
||||
|
||||
updateRole(role, data, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Updates a role in a server.
|
||||
|
||||
- **role** - a Role_
|
||||
- **data** - an `object` taking the structure shown below
|
||||
- **callback** - a `function` taking the following:
|
||||
- **error** - error if any occurred
|
||||
- **role** - the updated Role_
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
// structure of data parameter (all attrs optional):
|
||||
{
|
||||
color : 0xFF0000,
|
||||
hoist : false,
|
||||
name : "A New Role!",
|
||||
permissions : [
|
||||
// see the constants documentation for full permissions
|
||||
"attachFiles", "sendMessages"
|
||||
]
|
||||
}
|
||||
|
||||
deleteRole(role, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -456,9 +453,8 @@ Deletes a role from a server
|
||||
|
||||
- **role** - The Role_ to delete
|
||||
- **callback** - `function` that takes the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
addMemberToRole(member, role, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -469,9 +465,8 @@ Adds a member of a server to a role in the server
|
||||
- **member** - A `User Resolvable`_
|
||||
- **role** - A Role_
|
||||
- **callback** - `function` that takes the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
removeMemberFromRole(member, role, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -482,9 +477,8 @@ Removes a member of a server from a role in the server
|
||||
- **member** - A `User Resolvable`_
|
||||
- **role** - A Role_
|
||||
- **callback** - `function` that takes the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
overwritePermissions(channel, roleOrUser, options, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -494,52 +488,15 @@ Overwrites the permissions of a role or a user in a channel
|
||||
- **roleOrUser** - a Role_ or a User_ object
|
||||
- **options** - an `object` containing a structure as shown below
|
||||
- **callback** - `function` that takes the following:
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
{
|
||||
"sendMessages" : false,
|
||||
"attachFiles" : true
|
||||
}
|
||||
|
||||
updateRole(role, data, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Updates a role in a server.
|
||||
|
||||
- **role** - a Role_
|
||||
- **data** - an `object` taking the structure shown below
|
||||
- **callback** - a `function` taking the following:
|
||||
|
||||
- **error** - error if any occurred
|
||||
- **role** - the updated Role_
|
||||
- **error** - error if any occurred
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
// structure of data parameter (all attrs optional):
|
||||
|
||||
{
|
||||
color : 0xFF0000,
|
||||
hoist : false,
|
||||
name : "A New Role!",
|
||||
permissions : [
|
||||
// see the constants documentation for full permissions
|
||||
"attachFiles", "sendMessages"
|
||||
]
|
||||
}
|
||||
|
||||
deleteInvite(invite, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Deletes an invite
|
||||
{
|
||||
"sendMessages" : false,
|
||||
"attachFiles" : true
|
||||
}
|
||||
|
||||
- **invite** - An `Invite ID Resolvable`_
|
||||
- **callback** - a `function` taking the following:
|
||||
|
||||
- **error** - error if any occurred
|
||||
|
||||
Events
|
||||
------
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ The Equality class is used to see if two objects are equal, based on ``object_1.
|
||||
|
||||
If any class in Discord extends equality, it means you should never the default equality operands (``==`` & ``===``) as they could potentially be different instances and therefore appear not to be equal. Instead, use ``equalityObject.equals()`` as shown below.
|
||||
|
||||
--------
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
--------
|
||||
|
||||
equals(object)
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ Invite
|
||||
|
||||
Used to represent data of an invite.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
--------
|
||||
|
||||
maxAge
|
||||
~~~~~~
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ Message
|
||||
|
||||
A Message object is used to represent the data of a message.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
-------
|
||||
|
||||
channel
|
||||
~~~~~~~
|
||||
|
||||
@@ -72,8 +72,6 @@ mentions
|
||||
|
||||
A Cache_ of User_ objects that were mentioned in the message.
|
||||
|
||||
------
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ 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
|
||||
----------------------
|
||||
|
||||
@@ -37,7 +39,7 @@ Valid Permission Names
|
||||
voiceMoveMembers,
|
||||
voiceUseVAD
|
||||
};
|
||||
|
||||
|
||||
Preferred Way
|
||||
-------------
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@ PermissionOverwrite is used to represent data about permission overwrites for ro
|
||||
Attributes
|
||||
----------
|
||||
|
||||
--------
|
||||
|
||||
id
|
||||
~~
|
||||
|
||||
|
||||
@@ -7,13 +7,11 @@ PMChannel
|
||||
|
||||
A PMChannel is a Private/Direct channel between the Client and another user.
|
||||
|
||||
------
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
--------
|
||||
|
||||
messages
|
||||
~~~~~~~~
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ Resolvables
|
||||
|
||||
In discord.js, the aim is to allow the end developer to have freedom in what sort of data types they supply. References to any sort of resolvable basically mean what types of data you can provide. The different resolvables are shown before:
|
||||
|
||||
--------
|
||||
|
||||
Channel Resolvable
|
||||
------------------
|
||||
|
||||
|
||||
@@ -5,13 +5,11 @@ Role
|
||||
|
||||
Represents data for a Server Role.
|
||||
|
||||
-----------
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
--------
|
||||
|
||||
position
|
||||
~~~~~~~~
|
||||
|
||||
@@ -52,13 +50,9 @@ client
|
||||
|
||||
The Client_ that cached the role.
|
||||
|
||||
------
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
-------
|
||||
|
||||
serialise()
|
||||
~~~~~~~~~~~
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ Server
|
||||
|
||||
Stores information about a Discord Server.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
--------
|
||||
|
||||
client
|
||||
~~~~~~
|
||||
|
||||
@@ -77,8 +77,6 @@ iconURL
|
||||
|
||||
The URL of the Server's icon. If the server doesn't have an icon, this will be null.
|
||||
|
||||
-----
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ ServerChannel
|
||||
|
||||
A ServerChannel is a Channel_ that belongs to a Server_.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
--------
|
||||
|
||||
name
|
||||
~~~~
|
||||
|
||||
|
||||
@@ -7,13 +7,11 @@ TextChannel
|
||||
|
||||
A text channel of a server.
|
||||
|
||||
------
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
--------
|
||||
|
||||
topic
|
||||
~~~~~
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ User
|
||||
|
||||
Stores information about users.
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
--------
|
||||
|
||||
client
|
||||
~~~~~~
|
||||
|
||||
@@ -58,14 +58,12 @@ typing
|
||||
since : 1448038288519, //timestamp of when
|
||||
channel : <Channel Object> // channel they are typing in.
|
||||
}
|
||||
|
||||
|
||||
avatarURL
|
||||
~~~~~~~~~
|
||||
|
||||
A valid URL to the user's avatar if they have one, otherwise null.
|
||||
|
||||
-----
|
||||
|
||||
Functions
|
||||
---------
|
||||
|
||||
|
||||
@@ -7,4 +7,4 @@ VoiceChannel
|
||||
|
||||
A voice channel of a server. Currently, the voice channel class has no differences to the ServerChannel class.
|
||||
|
||||
------
|
||||
--------
|
||||
|
||||
@@ -7,20 +7,18 @@ VoiceConnection
|
||||
|
||||
As of discord.js v5.0.0, voice support has been added. This means you can stream audio but not yet receive.
|
||||
|
||||
---------
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
---------
|
||||
|
||||
voiceChannel
|
||||
------------
|
||||
~~~~~~~~~~~~
|
||||
|
||||
VoiceChannel_ that the connection is for
|
||||
|
||||
client
|
||||
------
|
||||
~~~~~~
|
||||
|
||||
Client_ the connection belongs to
|
||||
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
.. discord.js documentation master file, created by
|
||||
sphinx-quickstart on Fri Sep 25 17:25:49 2015.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
.. include:: ./vars.rst
|
||||
|
||||
Welcome to discord.js's documentation!
|
||||
@@ -15,8 +10,6 @@ Feel free to make any contributions you want, whether it be through creating an
|
||||
|
||||
.. note:: This documentation is still a work-in-progress, apologies if something isn't yet documented!
|
||||
|
||||
Contents:
|
||||
|
||||
.. _docs:
|
||||
|
||||
.. toctree::
|
||||
@@ -25,16 +18,6 @@ Contents:
|
||||
|
||||
migrating
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Channel Documentation
|
||||
|
||||
docs_channel
|
||||
docs_pmchannel
|
||||
docs_serverchannel
|
||||
docs_textchannel
|
||||
docs_voicechannel
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Documentation
|
||||
@@ -46,6 +29,16 @@ Contents:
|
||||
docs_invite
|
||||
docs_voiceconnection
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Channel Documentation
|
||||
|
||||
docs_channel
|
||||
docs_pmchannel
|
||||
docs_serverchannel
|
||||
docs_textchannel
|
||||
docs_voicechannel
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Permission Documentation
|
||||
@@ -54,7 +47,7 @@ Contents:
|
||||
docs_role
|
||||
docs_permissionoverwrite
|
||||
docs_channelpermissions
|
||||
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Util Documentation
|
||||
@@ -63,12 +56,5 @@ Contents:
|
||||
docs_equality
|
||||
docs_resolvables
|
||||
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`search`
|
||||
|
||||
.. _Discord : https://discordapp.com/
|
||||
.. _discord.io : https://github.com/izy521/discord.io
|
||||
|
||||
@@ -5,23 +5,19 @@ Updating to v5.0.0
|
||||
|
||||
If you're coming from versions below v5, you might find some changes. Here are the major changes:
|
||||
|
||||
--------
|
||||
|
||||
Change 1
|
||||
--------
|
||||
|
||||
--------
|
||||
|
||||
.. code-block:: js
|
||||
|
||||
// OLD:
|
||||
|
||||
|
||||
client.getUser();
|
||||
client.getServer();
|
||||
server.getMember(); // etc etc
|
||||
|
||||
|
||||
// NEW:
|
||||
|
||||
|
||||
client.users.get();
|
||||
client.servers.get();
|
||||
client.members.get();
|
||||
Reference in New Issue
Block a user