Commit Graph

82 Commits

Author SHA1 Message Date
Rodry
00bd92a451 refactor: ES2021 features (#6540)
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Co-authored-by: Voltrex <mohammadkeyvanzade94@gmail.com>
2021-09-03 12:58:01 +01:00
Rodry
b4afcf8236 docs: general cleanup and improvements (#6299)
Co-authored-by: DaStormer <40336269+DaStormer@users.noreply.github.com>
Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
2021-08-05 20:34:06 +01:00
1Computer1
00bae4fe6b refactor: remove extended collection (#6246)
Co-authored-by: iCrawl <buechler.noel@outlook.com>
2021-07-31 12:08:59 +01:00
Antonio Román
a7c6678c72 refactor: change xID to xId (#6036)
* refactor: change `xID` to `xId`

* Update src/managers/MessageManager.js

Co-authored-by: Noel <buechler.noel@outlook.com>

Co-authored-by: Noel <buechler.noel@outlook.com>
2021-07-04 19:54:27 +01:00
Sugden
1e8f01253e refactor: new node features (#5132)
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
2021-06-30 21:40:33 +01:00
Shubham Parihar
1ac9a2eb5b refactor(*): make typedefs for all options params (#5785)
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-06-13 19:32:54 +01:00
Amish Shah
c6aeebb18d feat(Sharding*): contexts for broadcastEval (#5756)
* feat(ShardClientUtil): add parameterList to broadcastEval

* feat(ShardingManager): add parameterList to broadcastEval

* chore: update typings

* refactor(Sharding*): use BroadcastEvalOptions

* chore: update typings

* docs: use serializable instead of stringifiable

* refactor: don't set broadcastEval default context

Co-authored-by: Antonio Román <kyradiscord@gmail.com>

* chore: fix inaccuracy in typings

* refactor(Sharding*): remove string-based broadcastEval

* fix(ShardingManager): incorrect usage of _broadcastEvalRaw

* refactor(ShardingManager): remove unnecessary method

* refactor(Sharding*): type check the eval script

* fix(ShardingManager): return Promise rejection rather than throwing an error

Co-authored-by: SpaceEEC <spaceeec@yahoo.com>

* chore: fix typings

Co-authored-by: SpaceEEC <spaceeec@yahoo.com>

Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
2021-06-09 18:14:33 +01:00
uhKevinMC
31b4390042 feat(ShardingManager): add options typings (#5583)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
2021-05-10 23:54:32 +02:00
monbrey
c9b53539d5 refactor(Sharding): use options objects (#5510)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-04-30 21:46:20 +02:00
Alex
001676c7a9 feat(ShardingManager): Allow b-Eval/fetchClientValues on a specific shard when not all are ready (#5222)
Co-authored-by: BennyDiscord <46286597+BennyDiscord@users.noreply.github.com>
2021-01-24 11:49:15 +01:00
Matt (IPv4) Cowley
2a6c363a8a feat(Shard): shard-specific broadcastEval/fetchClientValues + shard Id util (#4991) 2020-11-22 13:35:18 +01:00
Alexander Kashev
766b91d306 docs(ShardingManager): fix typo in JSDoc (#4158)
Fix typo introduced in PR #4157 in the link to Node docs
2020-05-05 22:45:30 +02:00
Alexander Kashev
99612ba14d docs(ShardingManager): remove experimental status of Worker threads (#4157) 2020-05-04 13:08:52 +02:00
Spooder
b5a7e5cdf0 docs(sharding): ShardingManager#createShard doesn't spawn the s… (#3875)
* Fixed createShard() to show an example!

* docs(ShardingManager): clarify createdShard docs

* docs(Shard): clarify manager parameter

* docs(ShardingManager): use an info tag for createShard's param

Co-Authored-By: Sugden <28943913+NotSugden@users.noreply.github.com>

Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
2020-03-07 06:00:11 +01:00
Crawl
c065156a88 chore: consistency/prettier (#3852)
* chore: consistency/prettier

* chore: rebase

* chore: rebase

* chore: include typings

* fix: include typings file in prettier lint-staged
2020-02-29 14:35:57 +01:00
BorgerKing
bbdbc4cfa7 feat: remove datastores and implement Managers (#3696)
* Initial commit: add 5 initial managers

- Base manager
- GuildChannelManager
- MessageManager
- PresenceManager
- Reaction Manager
- Added LimitedCollection

* Add GuildEmojiManager, various fixes

* Modify some managers and add guildmembermanager

* Initial integration

* Delete old stores

* Integration part two, removed LRUCollection

- Most of the integration has been finished
- TODO typings
- Removed LRUCollection, needless sweeping

* Typings + stuff i somehow missed in ChannelManager

* LimitedCollection typings/ final changes

* Various jsdoc and syntactical fixes, Removed Util.mixin()

* tslint fix

* Grammatical and logical changes

* Delete temporary file placed by mistake

* Grammatical changes

* Add missing type

* Update jsdoc examples

* fix: ChannelManager#remove should call cache#delete not cache#remove

* fix recursive require

* Fix missed cache in util

* fix: more missed cache

* Remove accidental _fetchMany change from #3645

* fix: use .cache.delete() over .remove()

* fix: missing cache in ReactionCollector

* fix: missed cache in client

* fix: members is a collection not a manager

Co-Authored-By: Sugden <28943913+NotSugden@users.noreply.github.com>

* fix: various docs and cache fixes

* fix: missed cache

* fix: missing _roles

* Final testing and debugging

* LimitedCollection: return the Collection instead of undefined on .set

* Add cache to BaseManager in typings

* Commit fixes i forgot to stage yesterday

* Update invite events

* Account for new commit

* fix: MessageReactionRemoveAll should call .cache.clear()

* fix: add .cache at various places, correct return type

* docs: remove mentions of 'store'

* Add extra documented properties to typings

Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
2020-02-11 20:21:07 +01:00
SpaceEEC
400cb56358 fix(ShardingManager): assert shardList to be spawned, not totalShards (#3649) 2020-01-13 14:12:18 +00:00
Kitten King
d8516efa36 docs: fix typos (#3404) 2019-07-25 17:18:23 +02:00
Antonio Román
01c708bc75 feat(Sharding): change waitForReady to spawnTimeout (#3080)
This means that you'll not only be able to choose between having a timeout or not, but also to set the amount of milliseconds as you wish.
2019-04-21 13:34:09 +02:00
SpaceEEC
bfab203934 fix(ShardingManager): do not spawn the last shard early
An off-by-one error resulted in the last shard getting the delay of the second last one.
Closes #3181
2019-04-05 14:46:25 +02:00
Gus Caplan
42505b78c1 chore: add strict mode (#2974) 2018-12-03 15:19:10 -06:00
Frangu Vlad
9085138f0d fix: Sharding Issues & Cleanup (#2952)
* fix: Sharding causing constant heartbeat / identify spam

* misc: Remove wait param in connect

* misc: Wait 2.5 seconds before sending identify again if session is resumable

* misc: Remove useless destroy call

* nit: Capitalization

* fix: Identify on HELLO not connectionOpen

* misc: Add different intervals for identify after invalid session
- 2500 if we couldn't resume in time
- 5000 if we didn't have a session ID (per the docs on identify, that a client can only connect every 5 seconds)
- Otherwise, just identify again

* misc: Only clear heartbeat if shard is fully dead

Reconnect clears it otherwise

* fix: Accessing .length on a Collection
2018-11-21 13:42:37 -06:00
Isabella
f3cad81f53 feat: Internal sharding (#2902)
* internal sharding

* ready event

* the square deal

* the new deal

* the second new deal

* add actual documentation

* the new freedom

* the great society

* federal intervention

* some of requested changes

* i ran out of things to call these

* destroy this

* fix: Client#uptime went missing

* fix(Client): destroy the client on login failure

This may happen duo invalid sharding config / invalid token / user requested destroy

* fix(Client): reject login promise when the client is destroyed before ready

* fix(WebSocketManager): remove redundancy in destroy method (#2491)

* typo(ErrorMessages): duo -> duo to

* typo(ErrorMessages): duo -> due

* fix: docs and options

* docs(WebSocketManager): WebSockethard -> WebSocketShard (#2502)

* fix(ClientUser): lazily load to account for extended user structure (#2501)

* docs(WebSocketShard): document class to make it visible in documentation (#2504)

* fix: WebSocketShard#reconnect

* fix: presenceUpdate & userUpdate
* presenceUpdate wasn't really being handled at all
* userUpdate handled incorrectly because as of v7 in the Discord API, it comes inside presenceUpdate

* re-add raw event

* member is now part of message create payload

* feat: Add functionality to support multiple servers with different shards (#2395)

* Added functionallity to spawn multiple sharding managers due to adding start and end shards

* Small fixes and limiting shard amount to max recommended

* Forgot a check in spawn()

* Fixed indentation

* Removed optiosn object documentation for totalShards

* More fixes and a check that the startShard + amount doesnt go over the recommended shard amount

* fix getting max recommended

* Removed async from constructor (my fault)

* Changed start and end shard to a shardList or "auto" + fixed some brainfarts with isNaN

* Changed the loop and totalShard count calculation

* shards are actually 0 based

* Fixed a problem with the gateway and handled some range errors and type errors

* Changed Number.isNan to isNaN and changed a few Integer checks to use Number.isInteger

* Added check if shardList contains smth greater than totalShards; made spawn use totalShards again; shardList will be ignored and rebuild if totalShards is 'auto'; fixed docs

* ShardingManager#spawn now uses a for..of loop; fixed the if statement inside the new for..of loop to still work as intended; made the totalShards be set to a new amount if smth manual is put into ShardingManager#spawn just like before; Fixed some spelling

* internal sharding

* ready event

* the square deal

* the new deal

* the second new deal

* add actual documentation

* the new freedom

* the great society

* federal intervention

* some of requested changes

* i ran out of things to call these

* destroy this

* fix: Client#uptime went missing

* fix(Client): destroy the client on login failure

This may happen duo invalid sharding config / invalid token / user requested destroy

* fix(Client): reject login promise when the client is destroyed before ready

* fix(WebSocketManager): remove redundancy in destroy method (#2491)

* typo(ErrorMessages): duo -> duo to

* typo(ErrorMessages): duo -> due

* fix: docs and options

* docs(WebSocketManager): WebSockethard -> WebSocketShard (#2502)

* fix(ClientUser): lazily load to account for extended user structure (#2501)

* docs(WebSocketShard): document class to make it visible in documentation (#2504)

* fix: WebSocketShard#reconnect

* fix: presenceUpdate & userUpdate
* presenceUpdate wasn't really being handled at all
* userUpdate handled incorrectly because as of v7 in the Discord API, it comes inside presenceUpdate

* Internal Sharding adaptation

Adapted to internal sharding
Fixed a bug where non ready invalidated sessions wouldnt respawn

* Fixed shardCount not retrieving

* Fixing style

removed unnecessary parenthesis

* Fixing and rebasing

lets hope i didnt dun hecklered it

* Fixing my own retardation

* Thanks git rebase

* fix: assigning member in message create payload

* fix: resumes

* fix: IS wont give up reconnecting now

* docs: add missing docs mostly

* fix: found lost methods

* fix: WebSocketManager#broadcast check if shard exists

* fix: ShardClientUtil#id returning undefined

* feat: handle new session rate limits (#2796)

* feat: handle new session rate limits

* i have no idea what i was doing last night

* fix if statement weirdness

* fix: re-add presence parsing from ClientOptions (#2893)

* resolve conflicts

* typings: missing typings

* re-add missing linter rule

* fix: replacing ClientUser wrongly

* address unecessary performance waste

* docs: missing disconnect event

* fix(typings): Fix 2 issues with typings (#2909)

* (Typings) Update typings to reflect current ClientOptions

* fix(Typings) fixes a bug with Websockets and DOM Types

* fix travis

* feat: allow setting presence per shard

* add WebSocketManager#shardX events

* adjust typings, docs and performance issues

* readjust shard events, now provide shardId parameter instead

* fix: ready event should check shardCount, not actualShardCount

* fix: re-add replayed parameter of Client#resume

* fix(Sharding): fixes several things in Internal Sharding (#2914)

* fix(Sharding) fixes several things in Internal Sharding

* add default value for shards property

* better implement checking for shards array

* fix travis & some casing

* split shard count into 2 words

* update to latest Internal Sharding, fix requested changes

* make sure totalShardCount is a number

* fix comment

* fix small typo

* dynamically set totalShardCount if either shards or shardCount is provided

* consistency: rename shardID to shardId

* remove Client#shardIds

* fix: typo in GuildIntegrationsUpdate handler

* fix: incorrect packet data being passed in some events (#2919)

* fix: edgecase of ShardingManager and totalShardCount (#2918)

* fix: Client#userUpdate being passed wrong parameter
and fix a potential edgecase of returning null in ClientUser#edit from this event

* fix consistency and typings issues

* consistency: shardId instances renamed to shardID

* typings: fix typings regarding WebSocket

* style(.eslintrc): remove additional whitespace

* fix(Client): remove ondisconnect handler on timeout

* docs(BaseClient): fix typo of Immediate

* nitpick: typings, private fields and methods

* typo: improve grammar a bit

* fix: error assigning client in WebSocketManager

* typo: actually spell milliseconds properly
2018-11-03 13:21:23 -05:00
Schuyler Cebulskie
ab3a439198 Add worker-based sharding to the ShardingManager (#2908)
* Add worker-based sharding mode to ShardingManager

* Fix ClientShardUtil mode

* Fix worker not being cleared on shard death

* Update docs and typings

* Clean up Client sharding logic a bit

* Add info about requirements for worker mode
2018-10-29 15:02:36 -04:00
Shayne Hartford
32b405a5be Change default token (#2843)
* Change default token

Default `token` to `process.env.CLIENT_TOKEN` like client does.

* 2/2

* 1/2
2018-09-23 21:36:28 +02:00
Lewdcario
f67d682223 fix(ShardingManager): respawnAll shard iteration 2018-07-10 21:39:58 -05:00
Lewdcario
938d87d5d6 fix(Shard): actually remove default execArgv 2018-07-01 10:17:20 -05:00
Isabella
bfbb723f42 feat(ShardingManager): add execArgv option (#2585) 2018-06-23 16:09:03 -05:00
Lewdcario
745669a7c9 docs: consistency 2018-04-29 13:28:12 -05:00
Schuyler Cebulskie
0d188c0fba Rename ShardingManager#launch event to shardCreate 2017-11-24 22:33:29 -05:00
Schuyler Cebulskie
26b28813a8 Use a custom promisified setTimeout 2017-11-19 13:47:04 -05:00
Schuyler Cebulskie
1338e9bd8e Update sharding docs some more 2017-11-19 02:30:20 -05:00
Schuyler Cebulskie
975da5f1a5 Rewrite sharding class descriptions and link Client 2017-11-19 02:21:29 -05:00
Schuyler Cebulskie
9cd097492c Update doc for ShardingManager#createShard id parameter 2017-11-19 02:06:38 -05:00
Schuyler Cebulskie
f777c19fbf Fix naming conflict with ShardingManager#respawn 2017-11-19 02:03:44 -05:00
Schuyler Cebulskie
a414e4884f Overhaul sharding 2017-11-19 01:28:46 -05:00
Schuyler Cebulskie
196cf7652e Add Shard#ready property and related events 2017-11-16 22:49:38 -05:00
Robin B
97823bc376 Various documentation adjustments (#2001)
* docs(various): Add "at" to createdAt description

* docs(Client): Adjust to fit with guilds property

* docs(various): Adjust phrasing & fix typos

* docs(various): Clarifications

* docs(Permissions): fix numerus

* docs(DataStore): capitalize DataStore

* docs(various): Formatting changes

* docs(Presence): Expand RichPresenceAssets docs

* Add space
2017-10-07 01:56:17 +02:00
iCrawl
2aa2f73c74 Docs cleanup 2017-08-17 20:04:01 +02:00
Gavin Wainwright
7b44262346 Destructure certain imports (#1634) 2017-06-29 00:43:26 +01:00
Gus Caplan
63e54982f4 Errors Standardization (#1246)
* errors and stuff

* more errors

* all the errors

* fix build
2017-06-25 18:48:05 +01:00
Crawl
ac92d2cecc Improve docs a bit 2017-04-30 04:30:44 +02:00
Amish Shah
eec79b5fd0 Increase WebSocket backoff time to alleviate reconnect issues 2017-04-22 21:16:58 +01:00
Schuyler Cebulskie
7232531eb1 Move all util methods into class
Remove TransformMessageOptions altogether
2017-02-15 22:25:18 -05:00
Schuyler Cebulskie
305070dded Remove experimental warning on sharding manager 2016-11-12 17:30:07 -05:00
Schuyler Cebulskie
60e0d507f0 Clean up nearly all promises to utilise chaining, other small fixes 2016-10-30 16:27:28 -04:00
Schuyler Cebulskie
8306d50bd8 Clean up a bunch of promise stuff 2016-10-30 12:47:17 -04:00
Amish Shah
a2f125e416 case sensitive 2016-10-26 19:27:52 +01:00
Amish Shah
4a5cef0ccf Rename getRecommendedShards to fetchRecommendedShards 2016-10-26 17:29:23 +01:00
Gus Caplan
9f7c630796 lel (#824) 2016-10-22 14:51:21 -04:00