* feat(DataResolver): prefer streams over buffers
* feat(DataResolver): add `resolveFileAsBuffer`
Add `resolveFileAsBuffer` to use it in `resolveImage` which still requires Buffers to work.
* fix(DataResolver): make sure `resolveFile` always returns a Promise
* refactor(DataResolver): use for-await-of
* fix(DataResolver): use forked form-data which supports custom streams
* fix(APIRequest): use forked form-data in code too
Co-authored-by: - <5144598+-@users.noreply.github.com>
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
* src: WIP Internal Sharding refactor
* src: Refactor unavailable guild check
Co-Authored-By: kyranet <kyradiscord@gmail.com>
* src: More WIP Code
F in the chat to the old manager
* src: It should work but Discord says no.
Seriously why is this not working!
* fix: Inflator causing issues
* src: Finishing touches and typings
* misc: Proper debug message
* fix: Making things hidden needs writable: true as well
* fix: Sharding allowing multiple of the same shard, negative shards or strings
* fix: Again... edge cases
I love you guys .w.
* misc: Touchups
* misc: Better error?
* docs: Typo
* typings: Requested changes
* src: Requested changes
* src: Fix issues, validate provided shard options and more
* src: Forgot to remove the listener
* lint: eslint complaining
* fix: Setting shardCount to auto crashing the process
* misc: Requested changes
* typings: Correct typings for shardCount client option
* typings: Add invalidSession event to the shard and correct typings
* src: Minor docs adjustements, and code consistency between setHelloTimeout and setHeartbeatTimeout
* src: Don't block reconnect while creating shards
Might fix silent disconnects *again*
* src: Prevent reconnect from running if the Manager isn't READY
That way, if a shard dies while we're still spawning, it won't cause issues
* fix: Retry to reconnect if there's a network error going on.
The manager *should* keep reconnecting unless the token is invalid
* src: Enhance onClose handler for shards in the manager
- If the close code is between 1000 and 2000 (inclusive), you cannot resume
I tested this locally
- If there's a session ID still present, immediately try to resume
Faster resumes :papaBless:
Otherwise, the invalid session event will trigger and it'll handle accordingly
I swear if I see a SINGULAR Silent DC I'm yeeting
* src: Fix error check
* src: Make sure message exists on the error
* src: Used the wrong property for the shardQueue
* src: Make the hello timeout be made by the client
god help
* docs: Correct docs for WSEvents
* misc: Remove old events from the Events constant
* src: Throw the HTTP error if we don't get a 401
* typings: Can't forget about them
* src: Implement some more fail safes just in case
Seriously, better safe than sorry! Gotta failproof it completely
* 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
* fix: better global ratelimit handling in RequestHandler
fix: Remove useless line
fix: Better global ratelimit management
* refactor: Changed RESTManager#globallyRateLimited to be a getter
* refactor: Remove RESTManager#globallyRateLimited getter
* docs: Updated comments to reflect latest changes
* 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
* fix: Capture stack traces in APIRouter to preserve async stack
* fix: Handle the stack trace better
* fix: Check if error is an instance of Error (5XX rejects with Result)
* fix: Error.captureStackTrace is not supported in all browsers
* [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
* Add timeDifference calcs back into ratelimits
And fix x-ratelimit-reset is in seconds, not ms: https://puu.sh/AIXxY/9b3989b248.png
* mutate reset time with date header instead
* fix defaulting of reset and remaining
if the reset header is not available, then the reset time should be Date.now() instead of the difference between the date header and Date.now()
If the date header is null, fall back to Date.now() since it's the best we can do (this should never happen, but safer to handle it just in case)
if remaining is 0 we don't want to default it back to 1 since 0 is falsy
* Fix some missing doc strings
Mainly just readonly tags
* Return an error when guild#allowDMs is ran from a bot account, and fix some return types
* WebhookClient implements Webhook, doesn't extend it
* Fix Client#rateLimit docs not showing what it returns
Cause I wanted to handle this event only to see no return props 🤔
* Actually make Client#rateLimit show the right info
Its an object with all the info
* tinify webpack
* meme
* fix long version
* more changes
* even smoler
* fix up logic
* fix build
* undo changes to user agent manager because its not webpack'd anymore
* the heck
* fix stupid
* clean up browser rules
* typo