Commit Graph

97 Commits

Author SHA1 Message Date
Almeida
8d80fec86d fix(Util): default animated to false when omitted on resolvePartialEmoji (#6725) 2021-10-02 13:38:37 +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
Jiralite
b89280a1dd docs(Util): Correct @param for cleanContent() (#6531) 2021-08-27 09:39:19 +01:00
MarkusRost
d6e6244336 fix(Util): allow empty strings in splitMessage (#6437) 2021-08-18 09:47:13 +01:00
Nico
3c17939fd5 fix(Util): remove truthy check before isNaN check (#6358)
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
2021-08-10 21:14:41 +01:00
ckohen
3725dcafc0 fix(Caching): sweep archived threads in all channel caches (#6312) 2021-08-06 13:54:19 +01:00
Sugden
e2e4f6518b refactor(*): use async functions (#6210) 2021-08-02 00:47:43 +01:00
ckohen
93e0239c80 fix(Util): fix collection import (#6256) 2021-08-01 01:26:16 +01:00
1Computer1
bf221f2bef fix: array/keyArray removed (#6245) 2021-07-31 09:45:33 +01:00
Scott Bucher
19b242ac10 feat(FetchRecommendedShardsOptions): account for large bot sharding (#6184)
Co-authored-by: Justin <justinleeong@gmail.com>
2021-07-29 02:52:51 +01:00
Rodry
6301728d35 refactor(Channel): change channel types to UPPER_CASE (#6035) 2021-07-08 21:32:19 +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
DTrombett
bd25ff5913 fix(Util): splitMessage not working with array (#6008)
Co-authored-by: muchnameless <12682826+muchnameless@users.noreply.github.com>
2021-07-03 13:25:43 +01:00
Antonio Román
2446ff5251 refactor(Util): make class extend null (#6000) 2021-07-03 13:25:35 +01:00
DTrombett
d742814686 docs(Util): methods removed on the base object (#5990) 2021-07-01 17:38:52 +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
Antonio Román
985d4d6a43 refactor: removed code and split options (#5918)
Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com>

BREAKING CHANGE: Removed `APIMessage#split`
BREAKING CHANGE: Removed `MessageEditOptions#code`
BREAKING CHANGE: Removed `BaseMessageOptions#code`
BREAKING CHANGE: Removed `BaseMessageOptions#split`
2021-06-26 23:11:40 +01:00
Rodry
e0efcc6ab0 docs(*): add links to Discord's API objects & data (#5862) 2021-06-24 09:55:44 +01:00
Shubham Parihar
1ac9a2eb5b refactor(*): make typedefs for all options params (#5785)
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
2021-06-13 19:32:54 +01:00
u9g
fbcbb29884 feat(Util): allow array for StringOptions' char (#5566)
Co-authored-by: Voltrex <62040526+VoltrexMaster@users.noreply.github.com>
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
Co-authored-by: Papaia <43409674+papaia@users.noreply.github.com>
Co-authored-by: Noel <icrawltogo@gmail.com>
2021-06-10 10:24:45 +01:00
monbrey
c4f1c75efa feat: general component improvements (#5787) 2021-06-09 13:59:12 +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
Rodry
7d9818e21a docs(ColorResolvable): Add Fuchsia to ColorResolvable typedef (#5676)
Also moved DARKER_GREY to its place in the Colors export on Constants.js
2021-05-27 12:13:58 +01:00
Advaith
f1c0c043b5 feat(Util): make cleanContent take a channel instead of a message (#5535) 2021-04-18 18:53:09 +02:00
Jan
a33eed71af refactor(Util): remove convertToBuffer (#5237) 2021-01-24 11:48:03 +01:00
Advaith
41078997ae feat(APIMessage): remove disableMentions (#4836)
* chore: remove disableMentions

* style: fix eslint
2020-12-14 13:51:31 +01:00
Souji
77b6a7d5bd fix(Util): throw token invalid for fetching rec. shard amount (#4779) 2020-09-04 12:51:15 +02:00
samsamson33
03580b23a3 feat(Util): add missing colors to docs (#3843)
Co-authored-by: Crawl <icrawltogo@gmail.com>
2020-08-11 23:40:07 +02:00
Souji
317f24076e fix(Util): support empty array for flatten (#4590) 2020-08-11 21:01:29 +02:00
모메MoMe
fb1dd6b53a fix(Util): Fix cleanContent mention exploit (#4663) 2020-07-29 12:47:20 +02:00
Sugden
44ac5fe6df fix(Util): cleanContent should remove mentions after formatting… (#3936) 2020-03-14 13:39:54 +01: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
Sugden
3d0c1df19d refactor(Guild)/fix(Util): use resolveID and regex for cleanCod… (#3837)
* refactor(Guild): use resolveID instead of resolve(...).id

* fix(Util): use regex for cleanCodeBlockContent
2020-02-28 18:26:37 +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
Crawl
3a0470b45c chore(deps): update deps and fix lint (#3833) 2020-02-24 23:14:31 +01:00
Ryan Munro
62b227c2bd fix(BaseManager): BaseManager#valueOf should return cache (#3776)
* BaseManager#valueOf should return cache

* Update Util#flatten to handle valueOf being a Collection

* Update Util.js - typo

Co-Authored-By: Amish Shah <amishshah.2k@gmail.com>

Co-authored-by: Amish Shah <amishshah.2k@gmail.com>
2020-02-12 22:26:17 +01:00
BorgerKing
bbdbc4cfa7 feat: remove datastores and implement Managers (#3696)
* 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>
2020-02-11 20:21:07 +01:00
1Computer1
dad0cd8e81 feat: external collection package (#2934)
* Use external collection package

* Complete typings

* Document properly base collection class

* Add clone since sort is now in-place

* Update for latest changes to package

* Fix whitespace

* Update docs link

* Oops

* Update Collection.js

* Update index.d.ts
2019-09-10 17:44:47 +02:00
BannerBomb
5d95a4b264 fix: Util#splitMessage when destructured (#3456) 2019-09-03 16:24:20 +02:00
BannerBomb
b662678f21 feat/fix(Util): fix animated part of parseEmoji regex and make id optional (#3407)
* Small changes to parseEmoji regex

I just made a small change to the parseEmoji regex, this change will make an invalid emoji, like `<aname:id>` return as null, before this change it would return as an animated emoji because the name started with an `a` which would result in false positives, then the `?` I added to the end of `(\d{17,19})?` is used if someone provided an emoji as `:name:` or `a:name:` it will return the correct values but have an invalid id.

* Update Util.js

2nd Update: I changed the regex to output the results if you provide `<aemoji:123456789012345678>` and <:aemoji:123456789012345678>` which will output `{ animated: false, name: "aemoji", id: "123456789012345678" }` or `<:emojiname:>` which outputs `{ animated: false, name: "emojiname", id: null }` or `<a:emoji:>` which would output `{ animated: true, name: "emoji", id: null }`. Before this PR the method would return that the emoji was animated if you provided something like `<anemojiname:emoji_id>` because the name started with an `a`.
2019-08-17 18:07:58 +02:00
TNThacker2015
e645dd6358 feat: Util.splitMessage always return an array (#3035)
* Making Util.splitMessage always return an array

Util.splitMessage sometimes returns an array, but other times it returns a string. This should make it so that it always returns an array.

* jsdoc

Co-Authored-By: TNThacker2015 <37024464+TNThacker2015@users.noreply.github.com>

* docs(Util): remove superfluous space in docstring
2019-07-30 00:25:35 +02: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
Vlad Frangu
d7a9b74523 src: Replace instanceof Array checks with Array.isArray and instanceof Buffer with Buffer.isBuffer (#3227)
* src: Replace instanceof Array checks with Array.isArray

* src: Buffer.isBuffer instead of instanceof Buffer
2019-04-29 17:49:41 +01:00
Purpzie
abd9d36816 feat(Util): resolve text parameter of splitMessage to a string (#3212) 2019-04-21 09:38:09 +02:00
izexi
520810d484 feat(Util): add YELLOW to ColorResolvable (#3182) 2019-04-14 14:58:33 +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
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