Commit Graph

1009 Commits

Author SHA1 Message Date
Amish Shah
2d68e837e5 voice: fix receiver null on immediate voiceStateUpdate 2018-11-15 21:38:02 +00:00
Lewdcario
3418b5a1a2 docs: restore Client#error docs that went missing 2018-11-06 14:59:02 -06:00
Lewdcario
08002d0576 fix: Client#userUpdate receiving wrong packet 2018-11-05 18:24:50 -06:00
Lewdcario
b59c75e402 docs: add missing docstring for Client#guildDelete 2018-11-05 13:29:07 -06:00
Souji
905f1c3262 docs: add missing docstring for Client#userUpdate (#2930)
* docs: add missing docstring for Client#userUpdate

* docs: indentn't

* docs: indentn't 2
2018-11-05 17:46:47 +01:00
Lewdcario
7796cb5d05 fix: Client#raw emitting twice 2018-11-04 23:26:40 -06:00
Lewdcario
be0d1cd663 fix: Client#shards not being set properly 2018-11-04 23:25:54 -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
SpaceEEC
01476de582 fix(VoiceConnection): compare new speaking to old to avoid TypeError 2018-10-20 12:12:21 +02:00
sillyfrog
2ba00038d1 fix(VoiceConnection): use Speaking#has to fire _stoppedSpeaking (#2896)
* Use match on speaking bitmask to fire _stoppedSpeaking

* Use constants and correct matching

* Correctly do a not check
2018-10-19 18:15:01 +02:00
Lewdcario
16076124b2 fix(Client#voiceStateUpdate): newState is guaranteed 2018-10-14 13:58:34 -05:00
Isabella
183ba25faf fix: emit voiceStateUpdate on guildMemberRemove (#2892)
* fix: emit voiceStateUpdate on guildMemberRemove

* apparently i am blind

* typings
2018-10-14 12:44:14 -05:00
Amish Shah
2e7094f9ea voice: fix disconnect without receiver edge case 2018-10-11 23:02:59 +01:00
Amish Shah
00a62a93e4 voice: catch errors before connection is ready 2018-10-04 20:57:52 +01:00
SpaceEEC
6b810b2331 fix(ClientPresence): use possibly extended constructor from structures 2018-10-04 12:36:25 +02:00
bdistin
96a0655609 refactor(WebhookClient): make token property non-enumerable (#2861)
* make WebhookClient#token non-enumerable

parity with Client to add the barest protection against accidental exposure

* requested change
2018-10-01 12:43:08 +02:00
bdistin
d8c97be142 docs: fix typos (#2868) 2018-10-01 12:38:36 +02: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
SpaceEEC
d2da771e0f docs(Client): fix syntax error in fetchInvite example 2018-09-18 11:04:54 +02:00
Ash
9c2924a1b4 docs(ChannelPinsUpdate): clarify time param (#2823) 2018-09-05 14:33:44 +02:00
Ash
e96a60361a feat(TextBasedChannel): add lastPinTimestamp and lastPinAt (#2813)
* add lastPinTimestamp

* typings

* use or instead of ternary
2018-09-03 09:11:52 +02:00
Isabella
be4d6f9dc3 feat: add ClientOptions#retryLimit (#2805)
* feat: add ClientOptions#retryLimit

* hydra needs to learn how to code right

* a default would probably help

* move incrementor & update comment

* clarify docs on Infinity
2018-09-01 04:51:35 +02:00
lipgloss
9c2aeb733a fix: private_channels always returns an empty array on ready (#2787) 2018-08-26 13:06:00 -05:00
Amish Shah
6f62d7d816 fix: voice not throwing errors on bad stream input (#2786) 2018-08-25 19:41:07 +01:00
Kyra
c4df02782e feat: Guild Integrations (#2760)
* feat: Guild Integrations

* feat: Guild#createIntegration

* feat: Add ws event GUILD_INTEGRATIONS_UPDATE

* docs: Add `GUILD_INTEGRATIONS_UPDATE` to WSEventType

* misc: Fixed requested change

* docs: Updated typings

* typings: Sort members by name
2018-08-24 16:03:29 +02:00
Isabella
928fb30040 fix: actually fix Readonly typos 2018-08-21 14:25:30 -05:00
bdistin
c62f01f0e4 refactor(BitField): base class for Permissions, ActivityFlags, Speaking (#2765)
* abstract BitField from Permissions

* reduce useless code, improve docs

* add a ReadOnly identifier to the return type of Bitfield#freeze()

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-1.html#partial-readonly-record-and-pick

* fix the RangeError

* update docs, convert Speaking and ActivityFlags to bitfields

* fix some docs

* Fix Speaking BitField oops

* docs for oops

* more incorrect docs

* Fix incorrectly named property

* add new classes to index

* fix missing @extends docs

* default bitfield resolve to 0, and cleanup defaulting everywhere

Also removes GuildMember#missiongPermissions() alias that had incorrect behavior

* Breaking: Rename Overwrite allowed and denied to allow and deny

To be consistent with the api's naming

* fix setSpeaking usage to bitfields instead of booleans

* fix speaking bug in playChunk

* docs: Updated typings

* fix: BitFieldResolvable should use RecursiveArray

* bugfix/requested change

* typings: Cleanup (#2)

* typings: Fix BitField#{toArray,@@iterator} output type

* typings: correct PermissionOverwrites property names and nitpicks
2018-08-21 11:56:41 +02:00
Frangu Vlad
0401b8ad77 feat: handle and forward WEBHOOKS_UPDATE events (#2762)
* src: Handle WEBHOOK_UPDATE events

* Commit rename of 77'
Or adding the letter S

* I missed this

* Properly do this now
Typos everywhere

* Typings

* refactor: remove now unnecessary guild variable
2018-08-21 10:38:35 +02:00
Frangu Vlad
94214fa733 misc: Remove Clyde (#2764)
* Remove Clyde

* Remove Clyde avatar overwrite

* Remove Clyde from the user pattern
2018-08-18 13:21:24 +02:00
Frangu Vlad
e935611e50 fix(GuildBanAddHandler): not emitting guildBanAdd for uncached users (#2763) 2018-08-18 10:53:23 +02:00
Amish Shah
e2726f5a9a voice: remove createReceiver, just use VoiceConnection.receiver 2018-08-16 18:30:54 +01:00
Amish Shah
97c34b5b6f voice: clean up packet handling 2018-08-16 11:28:28 +01:00
Amish Shah
64832abfdb voice: clear connect timeout after connected (fixes #2752) 2018-08-15 14:25:47 +01:00
Amish Shah
38597de271 voice: patch in default VoiceStateUpdate in case on doesn't exist, cache member 2018-08-15 14:02:11 +01:00
bdistin
6506252054 fix/refactor: fix GuildMember#presence getter and cleanup (#2751)
* Fix guild being a guild and not an AbstractHandler in PresenceUpdate

* update the default guild to be a Guild, and not GuildMember

* getters return null instead of undefined

* fix lint
2018-08-15 08:50:22 +02:00
Kyra
75254748b1 fix(Client): do not redefine _timeouts and _intervals of BaseClient (#2748)
Fixes an issue with the process permanently hanging.
2018-08-14 20:39:56 +02:00
Amish Shah
e0f52162ea voice: allow for streaming silence to avoid audio glitches with repeated pausing/resuming (#2354) 2018-08-14 12:12:59 +01:00
Amish Shah
6852a15cee voice: fix StreamDispatcher#pause trying to call null function 2018-08-13 17:54:11 +01:00
Amish Shah
bfde1dd8f2 fix: StreamDispatcher doesn't emit finish if ended while paused (#2648) 2018-08-13 17:35:21 +01:00
Amish Shah
ea764afad2 add ClientPresence, remove ClientPresenceStore 2018-08-11 10:46:51 +01:00
Amish Shah
34ed3c6014 Update documentation for presenceUpdate 2018-08-10 17:09:05 +01:00
Amish Shah
08eff66939 Make presences track users and guilds, emit them in presenceUpdate 2018-08-10 16:46:14 +01:00
Amish Shah
fe8ece0192 voice state fixes 2018-08-10 15:15:52 +01:00
Amish Shah
be5efea461 rewrite voice state handling 2018-08-10 14:44:59 +01:00
Amish Shah
ee6c19ca7e voice: rewrite GuildMember#speaking tracking (#2540) 2018-08-09 13:59:52 +01:00
Amish Shah
55863efa15 voice: don't clear reject timeout until connection fully resolved (#2421, #2578) 2018-08-09 13:00:46 +01:00
Amish Shah
46fa9603c2 voice: delete receive stream immediately to prevent it being written to after end (#2678) 2018-08-07 17:34:01 +01:00
bdistin
5afd77ab73 refactor: remove user bot methods (#2559)
* [WIP] Remove user bots

* more backend userbot removal

* Add mfaEnabled back

* revert client presences store removal

* partially revert getAuth changes

* remove more no longer used children of ClientUserGuildSettings

* fix a bug with this pr and TextBasedChannel.applyToClass

* remove a syncGuilds reference

* more user bot data handling

* various guildSync cleanup

* bots can't call logout

Had the user/bot portions of the code mixed up. Though, does this need to be a promise anymore?

* make ClientManager#destroy() sync

It nolonger needs to be a promise, and nothing depended on it being a promise that I can tell.

* requested change

* Fix massive error

* no longer used as it's userbot only
2018-07-25 22:14:23 -04:00
Gymnophoria
717e7f094a docs(Client): clarify messageReactionRemove event's user description (#2657)
* Clarify messageReactionRemove user description

* Update MessageReactionRemove.js

* wait one more word difference lol
2018-07-18 11:41:05 +02:00