mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Some docs
This commit is contained in:
@@ -23,7 +23,7 @@ Functions
|
||||
get(key, value)
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Returns a contained object where ``object[key] == value``. Returns the first object found that matches the criteria.
|
||||
Returns a contained object where ``object[key] == value``. Also works if value is a regex or a function. Returns the first object found that matches the criteria.
|
||||
|
||||
getAll(key, value)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -9,6 +9,38 @@ This page contains documentation on the `Discord.Client` class. This should be u
|
||||
|
||||
--------
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
||||
Client takes an options object, and supports the following properties.
|
||||
|
||||
forceFetchUsers
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Make the library get all the users in all guilds, and delay the ready event until all users are received. This will slow down ready times and increase initial network traffic.
|
||||
|
||||
compress
|
||||
~~~~~~~~
|
||||
|
||||
Have Discord send a compressed READY packet.
|
||||
|
||||
largeThreshold
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Set a custom large_threshold (the max number of offline members Discord sends in the initial GUILD_CREATE). The maximum is 250.
|
||||
|
||||
rateLimitAsError
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
Have the lib throw a rejection Promise/callback when being ratelimited, instead of auto-retrying.
|
||||
|
||||
maxCachedMessages
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
The maximum number of messages to cache per channel. Decreasing this leads to more missing messageUpdated/messageDeleted events, increasing this leads to more RAM usage, especially over time
|
||||
|
||||
--------
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
@@ -32,10 +64,20 @@ servers
|
||||
|
||||
A Cache_ of Server_ objects that the client has cached.
|
||||
|
||||
unavailableServers
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
A Cache_ of Server_ objects that the client has cached that are unavailable.
|
||||
|
||||
voiceConnections
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
A Cache_ of VoiceConnection_ objects that the client is in.
|
||||
|
||||
voiceConnection
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
A VoiceConnection_ object that is the current voice connection (if any).
|
||||
Returns a VoiceConnection_ object, is an alias to voiceConnections[0].
|
||||
|
||||
readyTime
|
||||
~~~~~~~~~
|
||||
@@ -447,11 +489,12 @@ Joins a Voice Channel to begin transmitting audio
|
||||
- **error** - error if any occurred
|
||||
- **connection** - VoiceConnection_, the created Voice Connection.
|
||||
|
||||
leaveVoiceChannel(`callback`)
|
||||
leaveVoiceChannel(channel, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Leaves the currently connected Voice Channel if connected
|
||||
|
||||
- **channel** - A `VoiceChannel Resolvable`_
|
||||
- **callback** - `function` that takes the following:
|
||||
- **error** - error if any occurred
|
||||
|
||||
@@ -564,10 +607,45 @@ Overwrites the permissions of a role or a user in a channel
|
||||
"attachFiles" : true
|
||||
}
|
||||
|
||||
forceFetchUsers()
|
||||
~~~~~~~~~~~~~~~~~
|
||||
muteMember(user, server, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
As of 12/02/2016, the API will now only return the online users in a server if it has more than 250 users. If you want to be aware of ALL users in a server, use this function. As of yet, it doesn't return anything and users are just silently and gradually added to the relevant servers.
|
||||
Server-mutes a member.
|
||||
|
||||
- **user** - A `User Resolvable`_ to mute
|
||||
- **server** - A `Server Resolvable`_ to mute the user in
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred.
|
||||
|
||||
unmuteMember(user, server, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Server-unmutes a member.
|
||||
|
||||
- **user** - A `User Resolvable`_ to unmute
|
||||
- **server** - A `Server Resolvable`_ to unmute the user in
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred.
|
||||
|
||||
deafenMember(user, server, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Server-deafens a member.
|
||||
|
||||
- **user** - A `User Resolvable`_ to deafen
|
||||
- **server** - A `Server Resolvable`_ to deafen the user in
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred.
|
||||
|
||||
undeafenMember(user, server, `callback`)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Server-undeafens a member.
|
||||
|
||||
- **user** - A `User Resolvable`_ to undeafen
|
||||
- **server** - A `Server Resolvable`_ to undeafen the user in
|
||||
- **callback** - `function` taking the following:
|
||||
- **error** - error if any occurred.
|
||||
|
||||
Events
|
||||
------
|
||||
|
||||
@@ -17,6 +17,7 @@ A Channel Resolvable allows:
|
||||
- Message_
|
||||
- User_ (in some instances)
|
||||
- String of Channel ID
|
||||
- String of User ID
|
||||
|
||||
File Resolvable
|
||||
------------------
|
||||
@@ -41,6 +42,7 @@ Voice Channel Resolvable
|
||||
A Voice Channel Resolvable allows:
|
||||
|
||||
- VoiceChannel_
|
||||
- Voice Channel ID
|
||||
|
||||
Message Resolvable
|
||||
------------------
|
||||
|
||||
@@ -72,6 +72,11 @@ avatarURL
|
||||
|
||||
A valid URL to the user's avatar if they have one, otherwise null.
|
||||
|
||||
bot
|
||||
~~~
|
||||
|
||||
A boolean that represents if the user is an official OAuth bot account or not.
|
||||
|
||||
voiceChannel
|
||||
~~~~~~~~~~~~
|
||||
|
||||
|
||||
@@ -109,6 +109,16 @@ but you may want to spoof it or manually disable it.
|
||||
|
||||
- `value` - `true` or `false`: whether or not you want the bot to show as speaking
|
||||
|
||||
setVolume(volume)
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Sets the current volume of the connecion. 1.0 is normal, 0.5 is half as loud, 2.0 is twice as loud.
|
||||
|
||||
getVolume()
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Returns the current volume. 1.0 is normal, 0.5 is half as loud, 2.0 is twice as loud.
|
||||
|
||||
stopPlaying()
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ var User = (function (_Equality) {
|
||||
this.discriminator = data.discriminator;
|
||||
this.id = data.id;
|
||||
this.avatar = data.avatar;
|
||||
this.bot = data.bot;
|
||||
this.bot = !!data.bot;
|
||||
this.status = data.status || "offline";
|
||||
this.game = data.game || null;
|
||||
this.typing = {
|
||||
|
||||
@@ -12,7 +12,7 @@ export default class User extends Equality{
|
||||
this.discriminator = data.discriminator;
|
||||
this.id = data.id;
|
||||
this.avatar = data.avatar;
|
||||
this.bot = data.bot;
|
||||
this.bot = !!data.bot;
|
||||
this.status = data.status || "offline";
|
||||
this.game = data.game || null;
|
||||
this.typing = {
|
||||
|
||||
Reference in New Issue
Block a user