Commit Graph

132 Commits

Author SHA1 Message Date
isonmad
e9fa8a438c fix Client.destroy bugs (#828)
* add test for Client.destroy()

* propagate errors in ClientManager.destroy

If the promise returned by logout() rejects, previously
it would be completely uncaught, and just return an
eternally pending promise that never resolved.

* fix RESTMethods.logout

Without a data argument, the POST that superagent sends causes
the discord server to reply with a HTTP 400 error:

text: '{"Content-Type": "Expected Content-Type to be one of set([\'application/json\'])."}',

* fix Client.destroy

_timeouts and _intervals were changed to Set objects in
commit 6ede7a32fd a month ago.

Changing them to arrays causes failures if you try to reuse
the client object again.

* always close websocket in ClientManager.destroy

Invoking logout does not implicitly cause the server to close
the websocket for you, so cleanup everything.

Otherwise the websocket being open keeps node alive and hanging
mysteriously until the connection hits a timeout.

* fix indentation for eslint
2016-10-26 14:49:45 +01:00
Schuyler Cebulskie
fc307fab8a Remove unnecessary array conversions 2016-10-16 21:14:59 -04:00
Gus Caplan
853a3dfa04 Add getRecommendedShards and automatic shard count in ShardingManager (#796)
* draft stuff

fix docstring for Client#token

Reorganise resolver

make env better for shards, clean up docs

Fix Gus' log messages

7

meh just gateway/bot not v7 :(

final changes, ready for mergin!

build docs

make default totalShards 'auto', fix docs for totalShards type

clean up docs more

run docs

* make consistancy real

* Update and rename getRecommendedShards.js to GetRecommendedShards.js

* Update GetRecommendedShards.js

* Update index.js

* Update RESTMethods.js

* Update Shard.js

* Update GetRecommendedShards.js

* Update ShardingManager.js

* run docs
2016-10-13 23:26:10 -04:00
Gus Caplan
32eeb8ad5e Fix feature/login (#790)
* eeeeeeee

* too tired

* ok gawdl3y

Signed-off-by: Gus Caplan <fluffyrobotcheese@gmail.com>
2016-10-10 02:55:09 -04:00
Schuyler Cebulskie
29b33bffaa Rearrange and clean up more webhook stuff 2016-10-09 15:50:50 -04:00
Schuyler Cebulskie
7a53f70978 Rename maxMessageCache -> messageCacheMaxSize 2016-10-09 15:16:54 -04:00
Schuyler Cebulskie
a717b60417 Add validation for all non-ws client options 2016-10-09 15:11:15 -04:00
Schuyler Cebulskie
dabe51fc8d Reorganise disabledEvents stuff 2016-10-09 14:41:57 -04:00
Programmix
3e2d6ccc48 Convert disabledEvents Array to Object (#786)
* Convert disabledEvents Array to Object

Increased performance

* Commit to please Lord Gawdl3y

* Nitpick with chopsticks
2016-10-09 14:22:52 -04:00
Schuyler Cebulskie
f9b7f9c27e Add readonly 2016-10-06 21:49:08 -04:00
Schuyler Cebulskie
79b0d3f2a5 Client.readyTime -> readyAt (consistency) 2016-10-06 21:48:25 -04:00
Programmix
c4e1e4f50f Add InviteResolvable (#766)
* Add InviteResolvable

Add InviteResolvable

* Return data as fallback instead

* Rename resolver method
2016-10-02 19:21:08 -04:00
Schuyler Cebulskie
682e33cad9 Whoopsies 2016-09-27 20:21:52 -04:00
Schuyler Cebulskie
b8e659d544 Make Client.emojis suck less 2016-09-27 20:11:22 -04:00
Schuyler Cebulskie
973dbe8266 Add more @readonly and clean up some stuff 2016-09-27 20:07:33 -04:00
Schuyler Cebulskie
1e57c968dd Made date/timestamps consistent and less shitty 2016-09-27 19:46:53 -04:00
Schuyler Cebulskie
ba8dd3467a Switch config back to camelCase 2016-09-27 18:42:32 -04:00
Schuyler Cebulskie
49d905a7b1 Reorganise some shard logic 2016-09-27 17:23:03 -04:00
Schuyler Cebulskie
e5a987e0ef Add client shard eval/client property fetching, and improve existing shard stuff 2016-09-27 02:19:53 -04:00
Schuyler Cebulskie
4fe30aa4d3 Rip out client sharding logic into its own class 2016-09-26 23:23:56 -04:00
Gus Caplan
b4f3575335 i am facepalming so hard right now (#740) 2016-09-26 03:55:54 -07:00
Amish Shah
f1cb39a319 Expose Presence and Game structures 2016-09-25 20:17:35 +01:00
Amish Shah
03651fd6e3 Change how presences are handled 2016-09-25 14:16:03 +01:00
Schuyler Cebulskie
d9bc5cea1e Small cleanups 2016-09-24 02:43:27 -04:00
Schuyler Cebulskie
d62551bea2 Remove old code 2016-09-24 02:20:48 -04:00
Schuyler Cebulskie
1008f601f4 Add shard client prop fetching, remove guild count fetching, improve eval 2016-09-24 02:12:45 -04:00
Schuyler Cebulskie
e4f416ae6c Add shard eval, broadcastEval, and fix fetchGuildCount response 2016-09-24 01:21:41 -04:00
Gus Caplan
063be5cee2 smarter sharding™ (#732) 2016-09-23 21:43:16 +01:00
Schuyler Cebulskie
4bf6ad30f3 Remove a line 2016-09-22 23:10:00 -04:00
Schuyler Cebulskie
3fa4ff13e3 Add ShardingManager.fetchGuildCount 2016-09-22 22:48:21 -04:00
Schuyler Cebulskie
e5bac1339d Improve Client.sweepMessages 2016-09-20 10:57:39 -04:00
Schuyler Cebulskie
6075ec0e19 Add more detail to debug message 2016-09-20 01:25:19 -04:00
Schuyler Cebulskie
8f1bc5edab Add swept messages counter and debug message 2016-09-20 01:14:15 -04:00
Schuyler Cebulskie
9503990a86 Rename max_message_lifetime to message_cache_lifetime 2016-09-19 17:52:11 -04:00
Schuyler Cebulskie
afc8e5bee0 Add message sweeping 2016-09-19 16:52:46 -04:00
Schuyler Cebulskie
47d873a8ca Move and improve debug/warn docs 2016-09-19 05:11:35 -04:00
Schuyler Cebulskie
6a94658dd7 Clean up some stuff 2016-09-19 04:32:24 -04:00
Schuyler Cebulskie
6ede7a32fd Switch timeouts/intervals to Sets 2016-09-19 04:16:32 -04:00
Schuyler Cebulskie
7d8667694d Fix massive timeout/interval memory leaks 2016-09-19 03:49:42 -04:00
Schuyler Cebulskie
336366d653 Bad Hydra. 2016-09-18 23:46:59 -04:00
Amish Shah
3dab19a3bc Add Client.fetchInvite 2016-09-11 18:19:55 +01:00
Schuyler Cebulskie
d42b589528 Rename emailOrToken -> tokenOrEmail 2016-09-08 22:27:38 -04:00
Tyler
6dfe160c52 Add get status() for Client (#622)
* Add get status() for Client

* Fix trailing space
2016-09-05 07:52:15 +01:00
Amish Shah
bcab8805af Add client.emojis and fix eslint 2016-09-04 17:54:31 +01:00
Amish Shah
1155c482f1 make client.readyTime a date 2016-09-04 11:55:23 +01:00
Schuyler Cebulskie
0b908f5bce Cleanup Part 2: Electric Boogaloo (Reloaded) (#594)
* Cleanup Part 2: Electric Boogaloo (Reloaded)

* Moar cleanup

* Tweak NOT_A_PERMISSION error
2016-09-04 10:08:09 +01:00
Amish Shah
5a9c42061f Fix permissionsFor 2016-09-03 23:46:39 +01:00
Amish Shah
16fbbde35c Make syncGuilds off limits to bot accounts 2016-09-03 23:25:26 +01:00
Schuyler Cebulskie
68acf37fd4 Add stricter/better ESLint config (#589)
* Add stricter/better ESLint config

* Remove more unnecessary @returns
2016-09-03 20:45:23 +01:00
Amish Shah
a172fffd76 Actually add GUILD_SYNC 2016-09-03 17:59:16 +01:00