Skip to content

Commit 28fce9e

Browse files
committed
Some docs
1 parent afa5fa1 commit 28fce9e

File tree

7 files changed

+103
-8
lines changed

7 files changed

+103
-8
lines changed

docs/docs_cache.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Functions
2323
get(key, value)
2424
~~~~~~~~~~~~~~~
2525

26-
Returns a contained object where ``object[key] == value``. Returns the first object found that matches the criteria.
26+
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.
2727

2828
getAll(key, value)
2929
~~~~~~~~~~~~~~~~~~

docs/docs_client.rst

Lines changed: 83 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,38 @@ This page contains documentation on the `Discord.Client` class. This should be u
99

1010
--------
1111

12+
Parameters
13+
----------
14+
15+
Client takes an options object, and supports the following properties.
16+
17+
forceFetchUsers
18+
~~~~~~~~~~~~~~~
19+
20+
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.
21+
22+
compress
23+
~~~~~~~~
24+
25+
Have Discord send a compressed READY packet.
26+
27+
largeThreshold
28+
~~~~~~~~~~~~~~
29+
30+
Set a custom large_threshold (the max number of offline members Discord sends in the initial GUILD_CREATE). The maximum is 250.
31+
32+
rateLimitAsError
33+
~~~~~~~~~~~~~~~~
34+
35+
Have the lib throw a rejection Promise/callback when being ratelimited, instead of auto-retrying.
36+
37+
maxCachedMessages
38+
~~~~~~~~~~~~~~~~~
39+
40+
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
41+
42+
--------
43+
1244
Attributes
1345
----------
1446

@@ -32,10 +64,20 @@ servers
3264

3365
A Cache_ of Server_ objects that the client has cached.
3466

67+
unavailableServers
68+
~~~~~~~~~~~~~~~~~~
69+
70+
A Cache_ of Server_ objects that the client has cached that are unavailable.
71+
72+
voiceConnections
73+
~~~~~~~~~~~~~~~
74+
75+
A Cache_ of VoiceConnection_ objects that the client is in.
76+
3577
voiceConnection
3678
~~~~~~~~~~~~~~~
3779

38-
A VoiceConnection_ object that is the current voice connection (if any).
80+
Returns a VoiceConnection_ object, is an alias to voiceConnections[0].
3981

4082
readyTime
4183
~~~~~~~~~
@@ -447,11 +489,12 @@ Joins a Voice Channel to begin transmitting audio
447489
- **error** - error if any occurred
448490
- **connection** - VoiceConnection_, the created Voice Connection.
449491

450-
leaveVoiceChannel(`callback`)
492+
leaveVoiceChannel(channel, `callback`)
451493
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
452494

453495
Leaves the currently connected Voice Channel if connected
454496

497+
- **channel** - A `VoiceChannel Resolvable`_
455498
- **callback** - `function` that takes the following:
456499
- **error** - error if any occurred
457500

@@ -564,10 +607,45 @@ Overwrites the permissions of a role or a user in a channel
564607
"attachFiles" : true
565608
}
566609
567-
forceFetchUsers()
568-
~~~~~~~~~~~~~~~~~
610+
muteMember(user, server, `callback`)
611+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
612+
613+
Server-mutes a member.
614+
615+
- **user** - A `User Resolvable`_ to mute
616+
- **server** - A `Server Resolvable`_ to mute the user in
617+
- **callback** - `function` taking the following:
618+
- **error** - error if any occurred.
619+
620+
unmuteMember(user, server, `callback`)
621+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
622+
623+
Server-unmutes a member.
624+
625+
- **user** - A `User Resolvable`_ to unmute
626+
- **server** - A `Server Resolvable`_ to unmute the user in
627+
- **callback** - `function` taking the following:
628+
- **error** - error if any occurred.
629+
630+
deafenMember(user, server, `callback`)
631+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
632+
633+
Server-deafens a member.
634+
635+
- **user** - A `User Resolvable`_ to deafen
636+
- **server** - A `Server Resolvable`_ to deafen the user in
637+
- **callback** - `function` taking the following:
638+
- **error** - error if any occurred.
639+
640+
undeafenMember(user, server, `callback`)
641+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
569642

570-
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.
643+
Server-undeafens a member.
644+
645+
- **user** - A `User Resolvable`_ to undeafen
646+
- **server** - A `Server Resolvable`_ to undeafen the user in
647+
- **callback** - `function` taking the following:
648+
- **error** - error if any occurred.
571649

572650
Events
573651
------

docs/docs_resolvables.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ A Channel Resolvable allows:
1717
- Message_
1818
- User_ (in some instances)
1919
- String of Channel ID
20+
- String of User ID
2021

2122
File Resolvable
2223
------------------
@@ -41,6 +42,7 @@ Voice Channel Resolvable
4142
A Voice Channel Resolvable allows:
4243

4344
- VoiceChannel_
45+
- Voice Channel ID
4446

4547
Message Resolvable
4648
------------------

docs/docs_user.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ avatarURL
7272

7373
A valid URL to the user's avatar if they have one, otherwise null.
7474

75+
bot
76+
~~~
77+
78+
A boolean that represents if the user is an official OAuth bot account or not.
79+
7580
voiceChannel
7681
~~~~~~~~~~~~
7782

docs/docs_voiceconnection.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ but you may want to spoof it or manually disable it.
109109

110110
- `value` - `true` or `false`: whether or not you want the bot to show as speaking
111111

112+
setVolume(volume)
113+
~~~~~~~~~~~~~
114+
115+
Sets the current volume of the connecion. 1.0 is normal, 0.5 is half as loud, 2.0 is twice as loud.
116+
117+
getVolume()
118+
~~~~~~~~~~~~~
119+
120+
Returns the current volume. 1.0 is normal, 0.5 is half as loud, 2.0 is twice as loud.
121+
112122
stopPlaying()
113123
~~~~~~~~~~~~~
114124

lib/Structures/User.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var User = (function (_Equality) {
3030
this.discriminator = data.discriminator;
3131
this.id = data.id;
3232
this.avatar = data.avatar;
33-
this.bot = data.bot;
33+
this.bot = !!data.bot;
3434
this.status = data.status || "offline";
3535
this.game = data.game || null;
3636
this.typing = {

src/Structures/User.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default class User extends Equality{
1212
this.discriminator = data.discriminator;
1313
this.id = data.id;
1414
this.avatar = data.avatar;
15-
this.bot = data.bot;
15+
this.bot = !!data.bot;
1616
this.status = data.status || "offline";
1717
this.game = data.game || null;
1818
this.typing = {

0 commit comments

Comments
 (0)