Commit Graph

79 Commits

Author SHA1 Message Date
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
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
bb0700ade3 fix: Util#cleanContent parsing of GuildMember 2018-08-13 15:59:35 -05: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
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
Lewdcario
41a1dee533 fix(Util): circular reference 2018-06-29 13:02:38 -05: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
bdistin
25b654d494 consistency is king (#2554) 2018-05-18 03:30:19 +02: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
Will Nelson
cf7dcba1a5 Add toJSON methods (#1859)
* tojson things

* fix client

* ignore private properties

* remove extra property descriptors

* handle primitive flattening

* remove unused import

* add toJSON to collections

* reduce stateful props

* state

* allow custom prop names when flattening

* fix client

* fix build

* fix flatten docs

* remove guild.available, cleanup permissions, remove arbitrary id reduction

* fix util import

* add valueOf as needed, update member props

* fix incorrect merge

* update permissionoverwrites and permissions

remove serialization of permissions in PermissionOverwrites#toJSON.
change Permissions#toJSON to serialize permissions, by default excluding
admin checks.

* change Permissions#toJSON to return the primitive

* Permissions#toJSON explicitly return bitfield
2018-03-01 23:00:21 -06:00
rei2hu
35babc706d Fix: discord sort method (#2355) 2018-02-23 21:18:42 -06:00
Ecstabis
3a3ca96b0d Added 2 basic role colors PINKISH_PURPLE and DARK_PINKISH_PURPLE (#2303)
* Added 2 basic role colors PINKISH_PURPLE and DARK_PINKISH_PURPLE

* Added documentation for added Colors PINKISH_PURPLE and DARK_PINKISH_PURPLE

* fix colour names

* docs
2018-02-20 16:51:03 -06:00
Lewdcario
d46eec4da4 fix(resolveColor): not interpreting DEFAULT correctly 2018-01-28 22:34:50 -06:00
Alex
e58ff642f5 Make Util#splitMessage handle edge cases properly (#2212)
* Make Util#splitMessage handle edge cases properly

* Restart Travis

* Set maxLength to 2000 + small tweak
2018-01-24 23:41:50 -06:00
Faith
58d85282b4 Fix Destructuring Errors in Util (#2171)
* Fix Destructuring

* Fix another one
2018-01-24 17:37:41 -06:00
SpaceEEC
2318812f7f fix: allow the Util#parseEmoji regex to match emoji identifier (#2229) 2018-01-04 20:29:32 +01:00