Commit Graph

387 Commits

Author SHA1 Message Date
Amish Shah
5c3f5d7048 Partials (#3070)
* Remove GroupDMChannels

they sparked no joy

* Start partials for message deletion

* MessageUpdate partials

* Add partials as an opt-in client option

* Add fetch() to Message

* Message.author should never be undefined

* Fix channels being the wrong type

* Allow fetching channels

* Refactor and add reaction add partials

* Reaction remove partials

* Check for emoji first

* fix message fetching

janky

* User partials in audit logs

* refactor overwrite code

* guild member partials

* partials as a whitelist

* document GuildMember#fetch

* fix: check whether a structure is a partial, not whether cache is true

* typings: Updated for latest commit (#3075)

* partials: fix messageUpdate behaviour (now "old" message can be partial)

* partials: add warnings and docs

* partials: add partials to index.yml

* partials: tighten "partial" definitions

* partials: fix embed-only messages counting as partials
2019-02-13 17:39:39 +00:00
SpaceEEC
db3ae0159b docs(Structures): note about extending prior to instantiating client (#2884) 2019-02-02 20:28:24 +01:00
Isabella
8230255c68 fix(ShardClientUtil#id): erroneously reporting as an array 2019-01-15 01:45:29 -06:00
Gus Caplan
42505b78c1 chore: add strict mode (#2974) 2018-12-03 15:19:10 -06:00
SpaceEEC
ecaec29380 fix(Util): throw an explicit error if a chunk exceeds the max length (#2936)
* fix(Util): throw an explicit error if a chunk exceeds the max length

* refactor(Util): consolidate both errors in splitMessage into one

* revert(Messages): do not unnecessarily change the error code

* revert(Messages): do not remove the word 'the'
2018-11-27 21:42:28 +01:00
Kyra
54aff3191e feat(Constants): add error code 50020 (#2953)
* feat(Constants): Add error code 50020

Which is throw when using the vanity-url endpoint: https://github.com/discordapp/discord-api-docs/pull/748/

* docs: Document the new code
2018-11-16 16:55:15 +01: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
Souji
78c4be52c6 docs(Collection): clarify example for tap method (#2881)
* docs: clarify example for Collection#tap

* docs: wording improvement
2018-10-10 10:29:53 +02:00
Daniel
62e7e26310 Add white to colours (#2853)
* add white to colorresolvable typedef

* add colour white
2018-10-01 14:02:50 +02:00
bdistin
3d8207a3db refactor: comprehensive permissionOverwrites refactor (#2818)
* wip: comprehensive permissionOverwrites refactor

* PermissionOverwrites.resolve should Promise.reject()

where a promise is the expected return value

* On second thought, async rewrite to automatically reject on throw

* Fix some docs

* Fix a bug

* fix 2 more bugs

* typings: Updated for latest commit

* typings: Add missing method in GuildChannel

* typings: Add missing `| null` in PermissionOverwriteOption type

* Suggested changes
2018-09-21 12:21:51 +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
Adam Gauthier
8821fd40bc cleanup: remove remaining apiRequestMethod docs and typings (#2806) 2018-08-29 08:43:28 +02: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
13f46b924b refactor: clean up rate limit handling (#2694)
* refactor: clean up rate limit handling

* requested changes

* remove request mode option

* fix dupe requests

* hardcode reaction ratelimits

* suggested changes

* fix small thing

* re-add restTimeOffset

* move restTimeOffset a bit

* i swear i know english its my native language ok

* requested changes

* fix: a bit *too* pre-emptive with ratelimits, now less so

* fix: dapi error shoudl reject with path

* fix: make errors in execute catchable

* fix promise return

* rebase is hard
2018-08-24 06:29:44 +02:00
Isabella
928fb30040 fix: actually fix Readonly typos 2018-08-21 14:25:30 -05:00
1Computer1
19c298f5cc refactor: rewrite message creation (#2774)
* Rework createMessage
- MessageAttachment is now structurally similar to FileOptions
- No longer mutates the object passed as options
- Supports more permutations of arguments

* Ignore complexity warning

* Refactor name finding

* Fix typo

* Update typings

* Default name to null for MessageAttachment

* Make Message#reply use transformOptions

* Move transformOptions

* Fix Message#reply

* Fix mutation

* Update tests

* Fix options passing

* Refactor into APIMessage

* Fix webhook send

* Expose APIMessage

* Add documentation

* Add types

* Fix type doc

* Fix another type doc

* Fix another another type doc (is this one even right!?)

* Remove trailing comma

* Properly clone split options

* Add support for sending file as stream

* Missed a doc

* Resolve files only once when splitting messages

* This looks nicer

* Assign directly

* Don't cache data and files

* Missing return type

* Use object spread instead Object.assign

* Document constructors

* Crawl is a little dot

* comp pls

* tests: sanitize local file path, disable no-await-in-loop
2018-08-21 18:22:29 +02: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
Kyra
6be8172539 misc: add UNKNOWN_WEBHOOK error code (#2775)
* Add UNKNOWN_WEBHOOK error code

* docs: Update typings
2018-08-21 10:41:42 +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
1e0379375e cleanup: remove more left-over selfbot constants (#2761)
* misc: Remove left-over selfbot stuff

* Forgot this
2018-08-18 10:55:09 +02:00
Isabella
bb0700ade3 fix: Util#cleanContent parsing of GuildMember 2018-08-13 15:59:35 -05:00
Amish Shah
ea764afad2 add ClientPresence, remove ClientPresenceStore 2018-08-11 10:46:51 +01:00
Amish Shah
be5efea461 rewrite voice state handling 2018-08-10 14:44:59 +01:00
Kyra
0f63c50c06 fix: Util.basename being unreliable (#2679)
* fix: Util.basename being unreliable

new URL for WHATWG parsing was not chosen because it only works for URLs and threw in local pathes, path.basename is unreliable (according to the devs' note), and path.parse seems to work well.

* docs: Update Util.basename's description
2018-08-10 11:23:22 +02:00
Alex Hîncu
ce8a679a14 fix(Collection): use Symbol.species for creating derived collections (#2715) 2018-08-10 10:57:33 +02:00
Isabella
f3d7f7c3bd refactor: move Message#cleanContent function to Util (#2703)
* refactor: move Message#cleanContent function to Util

* suggested changes
2018-08-09 14:27:05 +02:00
1Computer1
8e0ea9aa16 Collection debug methods, remove deleteAll (#2577) 2018-08-09 14:25:07 +02:00
Amish Shah
98dc2df6d4 Revert "fix(Collection): use new this.constructor instead of new Collection (#2709)"
This reverts commit c10b4feeeb.
2018-08-07 19:08:51 +01:00
Alex Hîncu
c10b4feeeb fix(Collection): use new this.constructor instead of new Collection (#2709) 2018-08-07 18:08:49 +02:00
Yukine
b38f537da8 feat: Add new Permission PRIORITY_SPEAKER (#2698) 2018-08-03 20:19:19 -04: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
PLASMAchicken
c46cbbfd84 docs: added sizes 16, 32, 64 (#2666)
* documented sizes 16, 32, 64

* Removed space

* Added typedef

* The options to provide => Options for the Image URL

* fixed
2018-07-25 21:04:47 -04:00
Lewdcario
41a1dee533 fix(Util): circular reference 2018-06-29 13:02:38 -05:00
Amish Shah
08bbbe9301 voice: handle new client_connect and client_disconnect packets 2018-06-22 18:38:33 +01:00
Amish Shah
1f7c1ddaa2 voice: start update to v4, fix heartbeats 2018-06-22 17:42:04 +01:00
Will Nelson
5e011dbc11 switch to node-fetch (#2587)
* switch to node-fetch

* remove useless var declaration

* remove method uppercasing

* rework concurrency

* Revert "rework concurrency"

This reverts commit ef6aa2697e.

* fix headers
2018-06-19 20:10:55 +02:00
Kyra
d02c303afd fix(Guild): equals method modifying features array of guild (#2544)
* Fixed a bug where Guild#equals would cause the given guild to lose its features

* Fix Util.arraysEqual

* Fixed docs for Util.arraysEqual

* Remove Util.arraysEqual
2018-05-29 11:15:19 +02:00
Kyra
30c7d6d1b1 feat(Guild#defaultMessageNotifications) (#2538)
* feat(Guild#defaultMessageNotifications)

* boolean -> DefaultMessageNotifications

* Space's requested change
2018-05-28 17:44:04 -05:00
SpaceEEC
56a9d1ba3c docs(Collection): make findKey method show up in docs
Solved by moving the eslint-enable line below the method header.
2018-05-19 08:50:39 +02:00
bdistin
25b654d494 consistency is king (#2554) 2018-05-18 03:30:19 +02:00
1Computer1
a732402c95 refactor: remove unnecessary Collection methods and add Collection#partition (#2511)
* Rework collection

* Fix docs

* Remove (prop, value) behavior

* Add back thisArg

* Put examples on same line

* Revert map to return array

* Make examples less specific

* Add thisArg to sweep and partition
2018-05-14 01:15:43 -05:00
bdistin
7a3a4d1388 feat: add Collection#sweep() (#2528) 2018-05-04 02:27:59 -05:00
1Computer1
9f918199d2 feat: add Collection#tap (#2507)
* Add Collection#inspect

* No u

* Rename to tap

* Rename variable

* Do it here too
2018-05-04 02:08:32 -05:00
SpaceEEC
ddab8096cf feat(DataResolver): account for discord.gg/invite/<code> invites 2018-05-03 21:09:55 +02:00
bdistin
17d2c2efb8 docs(Collection): fix spelling of 'behavior' (#2529) 2018-05-03 08:00:56 +02:00
Amish Shah
b5f37728a7 feature: allow sweeping of inactive request buckets 2018-05-02 17:57:48 +01:00
Daniel Odendahl Jr
95b531742a fix: TypeError in mixin function (#2506) 2018-04-24 18:35:07 -05:00
Isabella
8b83553462 refactor: role stores (#2478)
* refactor: reduced duplication in role stores

* fix docs

* fix: typo

* most of requested changes

* rest of changes

* ACTUAL rest of changes

* docs

* doooocs

* reason
2018-04-24 15:52:00 -05:00
SpaceEEC
f6216f3905 feat(SnowflakeUtil): allow snowflakes to be generated dynamically (#2459) 2018-04-17 09:00:18 -05:00