Commit graph

177 commits

Author SHA1 Message Date
Voxelli
56e67185fc
fix(websocketshard): backport zombie connection fix (#9003) 2023-01-02 15:58:08 +01:00
RedGuy12
8a6588a132
feat(Util): backport escapeMarkdown PRs to v13 (#8703) 2022-10-10 19:14:36 +02:00
Antonio Román
3c62bd2d47
refactor: import timers, process, and Buffer from node: (#7157)
Co-authored-by: muchnameless <12682826+muchnameless@users.noreply.github.com>
Co-authored-by: Almeida <almeidx@pm.me>
2021-12-28 10:15:24 +01:00
Almeida
a194d9c37f
refactor: use optional chaining (#6757) 2021-10-05 00:04:53 +02:00
Almeida
531b46c60d
refactor: use the node: protocol (#6710) 2021-10-02 13:40:02 +02:00
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
Souji
6e3236ab64
fix(Message): make #channel and #guild getters (#6271) 2021-08-04 21:47:32 +01:00
1Computer1
bb5e648f3d
refactor: merge collections with keeping entries at max (#6242) 2021-07-31 21:03:58 +01:00
Justin
e000af5c98
feat(WebhookClient): allow creation of clients via URLs (#6192) 2021-07-29 11:48:43 +01:00
Rodry
6301728d35
refactor(Channel): change channel types to UPPER_CASE (#6035) 2021-07-08 21:32:19 +01:00
1Computer1
9cd5e7ed61
refactor(Managers): rename add to _add (#6060) 2021-07-08 11:34:45 +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
1Computer1
8c7cb0eff8
feat(Managers): add customizable caching for managers (#6013) 2021-07-04 00:26:26 +01:00
Antonio Román
a11a10525b
refactor: rename events to be consistent with WS names (#6010)
Co-authored-by: Noel <buechler.noel@outlook.com>
2021-07-03 13:23:53 +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
Souji
7b85a7259f
feat(*): enforce strings (#4880)
BREAKING CHANGE: Removes all Resolvables for only string inputs

Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
2021-06-01 16:31:49 +01:00
cherryblossom000
b376f31af9
fix(DataResolver): fix circular dependency error with GuildTemplate (#5622) 2021-05-22 21:40:44 +02:00
Carter
685b2604e4
docs: update docs and examples for #4879 (#5323)
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
2021-03-29 05:51:42 +02:00
nopeless
4099c28776
test: client should destroy (#5353)
Co-authored-by: Adrian Paschkowski <leiter04@gmail.com>
2021-03-28 15:22:04 +02:00
Sugden
ee5bc1a5c4
refactor: switch api and gateway to V8 (#4879)
Co-authored-by: Jan <66554238+Vaporox@users.noreply.github.com>
2021-02-11 18:10:35 +01:00
Alon Livne
09d1f2f18f
feat(ReactionCollector): event create (#4108)
* fix(Typing): setSpeaking public

* feat(ReactionCollector): create event, close #2844

* Revert "fix(Typing): setSpeaking public"

This reverts commit ccc0e0cc76.
2021-01-27 12:13:15 +01:00
Matt (IPv4) Cowley
aaed72b723
refactor(Client): remove fetchAllMembers option (#5257)
* feat(Client): remove fetchAllMembers option & logic

* Cleanup

* Missed type change
2021-01-27 11:27:50 +01:00
Noel
0a591a9697
feat(Browser): remove browser � (#5113) 2020-12-14 13:56:16 +01:00
Advaith
41078997ae
feat(APIMessage): remove disableMentions (#4836)
* chore: remove disableMentions

* style: fix eslint
2020-12-14 13:51:31 +01:00
monbrey
60e5a0e46f
feat(Message|TextChannel): Inline replies (#4874)
* feat(Message): remove reply functionality

* feat(InlineReplies): add INLINE_REPLY constant/typing

* feat(InlineReplies): add Message#replyReference property

* feat(InlineReplies): add typings for sending inline replies

* feat(InlineReplies): provide support for inline-replying to messages

* feat(Message): add referencedMessage getter

* fix: check that Message#reference is defined in referencedMessage

* refactor(InlineReplies): rename property, rework Message resolution

* docs: update jsdoc for inline replies

* feat(Message): inline reply method

* fix(ApiMessage): finish renaming replyTo

* fix: jsdocs for Message#referencedMessage

Co-authored-by: Tristan Guichaoua <33934311+tguichaoua@users.noreply.github.com>

* fix: restore reply typings

* fix: dont pass channel_id to API when replying

* chore: update jsdocs

* chore: more jsdoc updates

* feat(AllowedMentions): add typings for replied_user

* fix: naming conventions

* fix(Message): referenced_message is null, not undefined

* fix(MessageMentionOptions): repliedUser should be optional

* chore: get this back to the right state

* fix(ApiMessage): pass allowed_mentions when replying without content

* fix(ApiMessage): prevent mutation of client options

Co-authored-by: almostSouji <timoqueezle@gmail.com>
Co-authored-by: Tristan Guichaoua <33934311+tguichaoua@users.noreply.github.com>
2020-12-08 21:08:26 +01:00
anandre
8c8883ef26
Remove Guild#member (#4890) 2020-11-22 19:21:01 +01:00
cherryblossom000
f2bbad36d5
feat(GuildManager): add AFK and system channel options in create (#4837)
This commit adds support for the `afk_channel_id`, `afk_timeout`, and
`system_channel_id` parameters in the
[create guild](https://discord.com/developers/docs/resources/guild#create-guild-json-params)
endpoint by adding the `afkChannelID`, `afkTimeout`, and
`systemChannelID` options in `GuildManager#create`.

This commit also fixes a minor bug in `create` when specifying types for
the channels due to the channel types not being changed from `'text'`,
`'voice'` etc to the corresponding numbers, so Discord would return an
error.
2020-09-25 23:44:32 +02:00
Sugden
9b5f005394
test: update tests (#3865)
* test: update tests

* style: fix indent

* test: suggested changes

* test: require correct directory

Co-authored-by: Crawl <icrawltogo@gmail.com>
2020-03-07 06:05:57 +01:00
Amish Shah
7d40c43ad4 chore: merge v12-dev master into stable 2020-03-01 17:57:30 +00: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
Papa
9c8aaf1bbc
feat: reimplement disableEveryone into disableMentions
* 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
2020-02-29 14:20:39 +01:00
Timo
9cb306c823
feat: replace disableEveryone with disableMentions (#3830)
* 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
2020-02-26 11:13:23 +00:00
bdistin
00c4098bb3 refactor(Util.escapeMarkdown): allow separate escaping and add tests (#3241)
* wip refactor

* add escapeMarkdown tests

* italics can be done with a single underscore too

* more refined

* fix test name

* unnecessary eslint ignores

* use jest

* make eslint less annoying in this test file

* more testing

* fix lib usage

* more tests and a small fix
2019-07-11 22:08:40 +02:00
Amish Shah
23e6414420 fix: old objects not being cached (#3225)
please post issues if you find any, will probably cause some
2019-04-23 11:32:03 +01:00
Isabella
cbb9b14950 test: add Webhook(Client) testing file (#2855)
* test: add WebhookClient testing file

* webhooks cant edit messages, silly

* add more webhook types as requested

* fix typo

* eslint matters

* fix(webhooktests): add 'use strict', remove embed: tests
2019-04-14 15:27:59 +02:00
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
Will Nelson
5cbdf38028 fix(WebSocketShard): add websocket send error handling (#2981)
* websocket send error handling

* fix: emit only when error is present

* refactor: use an if instead
2018-12-22 08:49:56 +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
Crawl
7684ad3ca6
fix(webpack): properly emitting process deprecation warnings 2018-08-22 04:54:09 +02: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
Amish Shah
e2726f5a9a
voice: remove createReceiver, just use VoiceConnection.receiver 2018-08-16 18:30:54 +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
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
Schuyler Cebulskie
419a2eea3f Bump version to 11.3.1 2018-03-03 15:38:24 -05:00
iCrawl
a7b46be923
fix: webpack minified and bump deps 2018-02-17 18:01:20 +01:00
iCrawl
1b9af41fbb
chore: update test 2018-02-16 09:55:22 +01:00
Amish Shah
2b5fc77a67
Rudimentary support for unified audio playing! 🎉 2018-01-19 23:55:59 +00:00
Amish Shah
2c1a302eea
Redesign voice receiving, still needs cleaning up 2018-01-19 21:14:03 +00:00