* User input sanitation: reimplement disableEveryone into disableMentions
* Change default value of ClientOptions#disableMentions to 'none'
* Update type declarations of disableMentions to include default
* update for compliance with ESLint
* Overlooked these files. Updated for complete compliance with ESLint
* add ClientOptions#disableMentions and MessageOptions#disableMentions
* provide tests
* don't sanitize controlled mentions
* add @here mentions to tests
* fix indents (6 spaces instead of 8)
* add Util#cleanContent tests
* add typings for removeMentions
* replace @ with @\u200b AFTER cleaning content as suggested instead of using removeMentions
* better explanation of this option
* no newline in Util.removeMentions
* fix long line
* remove double space
* remove comments (change has been reverted)
* Use Util.removeMentions to remove mentions
* use Util.removeMentions in Util.cleanContent
* 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>
* src: Step 1 of who knows how many
* src: Remove accidentally committed test file
* src: Remove useless added property in package.json
* docs: Trailing spaces, come back >.>
* src: Buhbye uws, we will miss you..not!
* src: Move 'auto' shard selection from totalShardCount to shards
* src: tweak
* src: Filter out floats from shard IDs
You want half of a shard or what?
* src: Misc cleanup and bugfix for GUILD_BAN_ADD
* src: Rewrite checkReady
* src: Misse this while merging master into my branch
* typings: Bring these up to date
* typings: Forgot allReady event
* src: Don't checkReady if the shard isn't waiting for guilds
* src: Fix a possible bug for when the ws dies and the session becomes -1
* src: Hopefully fix last edge case that could case a shard to infinitely boot loop
* src: Rename totalShardCount to shardCount
* src: Small bugfix
* src: Correct error message for shardCount being imvalid
Co-Authored-By: bdistin <bdistin@gmail.com>
* src: Small tweaks
* src: If this doesn't fix the issues I'm gonna throw a brick at my PC
* src: I swear, STOP BREAKING
* src: *groans at a certain snake*
* src: Use undefined instead of null on destroy in close event
Setting it to null sets the close code to null, which causes a WebSocket error to be thrown. The error is thrown from WebSocket, although there is no connection alive. Fun times!
* src: @SpaceEEC's requested changes
* src: Remove zucc from discord.js
Discord is removing support for it, sooo... Bye bye
* src: Missed this
* src: Apply @kyranet's suggestions
Co-Authored-By: Antonio Román <kyradiscord@gmail.com>
* src: @kyranet's suggestions
* src: Remove pako, update debug messages
- Pako is officially gone from both enviroments
Install zlib-sync on node.js if you want it
- Improve a few debug messages some more
- Discover that internal sharding works in browsers but please don't do that
* Disambiguate the description of <client>.channels
Although not explicitly said, the current wording makes it seem like all channels are cached and available at any time in this store. Hopefully this variation makes it a bit clearer.
* make more explicit (I think)
* remove trailing white spaces
* docs: make voice public
* typings: Update typings to match the docs
* typings: ClientVoiceManager is nullable in Client
Co-Authored-By: vladfrangu <kingdgrizzle@gmail.com>
* typings: Mark client as readonly
Co-Authored-By: vladfrangu <kingdgrizzle@gmail.com>
* src: Make the client readonly
* src: Remove Client#voiceConnections getter in favor of ClientVoiceManager#connections
* 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
* 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
* 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
* 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
* 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
* 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
* [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
* 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
* Fix documentation for GuildAuditLogEntry.target
* Update documentation for CategoryChannel#children
* Add EntryTarget for audit logs
I've done this to "fulfill" devsneks request while also showing all the possible results for the target of an AuditLogEntry
* Oops Eslint
* Private timeout sets gets set by BaseClient not WebhookClient
* Fix the "Missing Docs" for Presence#activity
* Small doc inconsistency
Array<Number> instead of Array<number> for Activity
* Client#emojis is an EmojiStore not a Collection
* Document ClientPresenceStore
Just so its clickable through the wiki, nothing else is documented
* Small fix for BaseClient#setInterval
You don't wait before executing, you execute every X ms
* GuildChannelResolvable takes a GuildChannel/Snowflake
* Typo in UserResolvable
* Another typo for UserResolvable
* Add the number to the Status and VoiceStatus docs
Its probably not needed, but just so the user knows what each number means, its now documented.
* Start Store cleanup
* wip store cleanup
* fix iterables initiating datastores
* handle the possibility of a datastore with no holds and no its own 'create' method
* more cleanup (instances that need more than just client/data)
* missed RoleStore extras
* not sure how eslint didn't catch that tab...
* avoid re-getting the channel we already have...
* cleanup resolvers and refactor them into DataStores
* ^
* and remove
* fix some bugs
* fix lint
* fix documentation maybe?
* formatting
* fix presences
* really fix presences this time
* bad fix was bad... let;s see how bad this one is..
* forgot to save a file
* make presence resolving take userresolveables too
* fix tabs in jsdocs
* fix bad fix from last night that caused issues, with better fix...
* oops