mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 02:53:31 +01:00
5.0.1 & docs
This commit is contained in:
@@ -7,6 +7,14 @@ 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.
|
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.
|
||||||
|
|
||||||
|
**Examples:**
|
||||||
|
|
||||||
|
.. code-block:: js
|
||||||
|
|
||||||
|
client.users.get("id", 11238414);
|
||||||
|
|
||||||
|
client.channels.getAll("name", "general");
|
||||||
|
|
||||||
--------
|
--------
|
||||||
|
|
||||||
Functions
|
Functions
|
||||||
|
|||||||
@@ -5,6 +5,14 @@ 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.
|
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.
|
||||||
|
|
||||||
|
**Examples:**
|
||||||
|
|
||||||
|
.. code-block:: js
|
||||||
|
|
||||||
|
var user_permissions = channel.permissionsOf(user);
|
||||||
|
|
||||||
|
var can_mention_everyone = user_permissions.hasPermission("mentionEveryone");
|
||||||
|
|
||||||
--------
|
--------
|
||||||
|
|
||||||
Functions
|
Functions
|
||||||
|
|||||||
@@ -7,6 +7,12 @@ 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.
|
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.
|
||||||
|
|
||||||
|
.. code-block:: js
|
||||||
|
|
||||||
|
object1.equals(object2); // GOOD ✓
|
||||||
|
|
||||||
|
object1 == object2; // BAD ✖
|
||||||
|
|
||||||
--------
|
--------
|
||||||
|
|
||||||
Functions
|
Functions
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ Feel free to make any contributions you want, whether it be through creating an
|
|||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
:caption: Util Documentation
|
:caption: Utility Documentation
|
||||||
|
|
||||||
docs_cache
|
docs_cache
|
||||||
docs_equality
|
docs_equality
|
||||||
|
|||||||
@@ -20,4 +20,26 @@ Change 1
|
|||||||
|
|
||||||
client.users.get();
|
client.users.get();
|
||||||
client.servers.get();
|
client.servers.get();
|
||||||
client.members.get();
|
client.members.get();
|
||||||
|
|
||||||
|
Change 2
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. code-block:: js
|
||||||
|
|
||||||
|
// OLD:
|
||||||
|
|
||||||
|
client.on("serverNewMember", (member, server) => {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// NEW:
|
||||||
|
|
||||||
|
client.on("serverNewMember", (server, user) => {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Change 3
|
||||||
|
---------
|
||||||
|
|
||||||
|
The Member Class has been removed, meaning you can't use ``member.permissionsIn(channel)``. To get permissions, use ``channel.permissionsOf(user)``.
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "discord.js",
|
"name": "discord.js",
|
||||||
"version": "5.0.0",
|
"version": "5.0.1",
|
||||||
"description": "A way to interface with the Discord API",
|
"description": "A way to interface with the Discord API",
|
||||||
"main": "./entrypoint.js",
|
"main": "./entrypoint.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user