Commit Graph

82 Commits

Author SHA1 Message Date
Jan
f7643f7bbe feat: interactions (#5448)
Co-authored-by: izexi <43889168+izexi@users.noreply.github.com>
Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
Co-authored-by: Advaith <advaithj1@gmail.com>
Co-authored-by: Shiaupiau <stu43005@gmail.com>
Co-authored-by: monbrey <rsm999@uowmail.edu.au>
Co-authored-by: Tiemen <ThaTiemsz@users.noreply.github.com>
Co-authored-by: Carter <carter@elhnet.net>
2021-05-07 17:22:33 +02:00
izexi
63398d6ae4 feat(Webhook): add 'fetchMessage' method (#5530) 2021-04-30 21:49:32 +02:00
Souji
116ecf246e feat(Webhook): sourceGuild, sourceChannel, improve owner (#5508) 2021-04-30 21:44:23 +02:00
Jan
164ddf668f refactor: rename Snowflake to SnowflakeUtil (#5502) 2021-04-15 00:37:54 +02:00
izexi
7cabc1c490 feat(Webhook): add '(edit|delete)Message' methods (#5223) 2021-04-03 15:06:18 +02:00
Advaith
41078997ae feat(APIMessage): remove disableMentions (#4836)
* chore: remove disableMentions

* style: fix eslint
2020-12-14 13:51:31 +01:00
Phineas
ea19faa411 Change domain to discord.com (#4160) 2020-06-19 11:46:59 +02:00
Jyguy
fee9a218e8 docs(MessageMentionTypes): move possible values to description (#3990)
* docs(MessageMentionTypes): correct type

* docs(MessageMentionTypes): change role to roles

* docs(MessageMentionOptions): correct description to allow usage as an array

* remove unneeded part of description

Co-Authored-By: Ryan Munro <rsm999@uowmail.edu.au>

* docs: add DisableMentionType to remove literal string types

Co-authored-by: Ryan Munro <rsm999@uowmail.edu.au>
2020-03-27 20:54:27 +01:00
Ryan Munro
df324e2c21 feat(AllowedMentions): add support for MessageOptions#allowedMe… (#3893)
* feat(Allowed Mentions): Add support for new Allowed Mentions message options

* fix(docs): Update JSDoc for feature

* fix(apimessage): translate the propery into snake_case

* fix(typings): message mention options should be optional

* fix(docs): jsdoc typings for MessageMentionOptions

* fix(mentions): use Resolvables for MessageMentionOptions

* fix(docs): typedef for MessageMentionTypes

* Update typings/index.d.ts

Co-Authored-By: Sugden <28943913+NotSugden@users.noreply.github.com>

* fix(mentions): drop support for Resolvables

* fix(AllowedMentions): remove the whole resolve function

* fix(docs): revert change to Resolvables

Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
2020-03-19 11:56:03 +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
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
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
SpaceEEC
e660ea90cc fix(Webhook): edit channel when editing avatar (#3588) 2019-12-27 19:27:48 +01:00
SpaceEEC
ea76a56639 feat(Webhook): add type property and created* getters (#3585)
* feat(Webhook): add created* getters

* feat(Webhook): add type property

* typings(WebhookFields): use primitive string for url getter

Co-Authored-By: Gryffon Bellish <owenbellish@gmail.com>

* fix(Webhook): token can be null

Co-authored-by: Gryffon Bellish <owenbellish@gmail.com>
2019-12-27 19:27:34 +01:00
Carter
330d5db586 feat(Webhook): addition of Webhook#avatarURL function (#3625)
* feat: addition of Webhook#avatarURL

* typings: added Webhook#avatarURL

* fix: trailing space

* docs: fixed jsdoc function description

* fix: typo
2019-12-15 20:20:15 +01:00
Vlad Frangu
fbd811517a src: Update Webhook#sendSlackMessage to be accurate with what the API returns (#3429)
* src: Update sendSlackMessage

* typings
2019-08-19 21:02:33 +01:00
SpaceEEC
c786867bd6 fix(Webhook): return raw data if the channel is unavailable
Fixes #3424
2019-08-18 11:45:28 +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
izexi
c078682722 feat(Webhook): add url getter (#3178)
* add Webhook#url

* set typing as readonly

* suggested change

* another one
2019-04-05 11:09:58 +02:00
SpaceEEC
840d22f892 docs(Webhook): add mising '@name' to Webhook#token's docstring 2018-12-30 12:52:33 +01:00
Gus Caplan
42505b78c1 chore: add strict mode (#2974) 2018-12-03 15:19:10 -06:00
SpaceEEC
0ab69c5ad4 fix(Webhook): APIMessage require should be a const 2018-09-23 17:04:22 +02:00
SpaceEEC
c0a9b08e73 fix(Webhook): APIMessage is not circular, fixes WebhookClients 2018-09-23 17:02:35 +02:00
Lewdcario
53420fa4e7 fix: Webhook#send not resolving content 2018-09-21 23:02:31 -05:00
bdistin
6d184257b3 refactor: remove duplicate send checks (#2790)
* re-direct pr code to master

* fix Webhook send docs

* requested changes

* typings: Updated to latest commit

* requested change

* requested change
2018-09-21 10:59:58 +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
Kyra
e0378cf350 refactor(Webhook): make token not enumerable (#2566)
* Hide Webhook#token (consistency with Client#token)

* Make `Webhook#token` writable

* fix: devsnek's requested change

Webhook#token must be both writable and configurable.
2018-07-18 11:37:57 +02:00
Lewdcario
077d41fbca fix(Webhook): import Channel correctly 2018-07-01 10:19:44 -05:00
Lewdcario
f293dddc29 fix: Webhook#edit attempting to use client.channels always 2018-05-02 21:19:00 -05:00
Lewdcario
745669a7c9 docs: consistency 2018-04-29 13:28:12 -05:00
Lewdcario
24571e465b docs: examples & improvements 2018-03-01 22:50:45 -06:00
Isabella
9eac19d9d8 refactor: more oop with stores (#2216)
* refactor: more oop with stores

* forgot bulk delete

* Revert "forgot bulk delete"

This reverts commit 1b4fb999ee07b358ee6e1af9efb8981b84f83af1.

* appease linter

* missed some


shh

* fail
2018-01-11 16:33:30 +00:00
SpaceEEC
05a41b5ca4 fix(Split/Webhook): readd message chunk sending and fix webhook avatar/username (#2085) 2017-11-06 02:42:24 +01:00
Gus Caplan
29a81eab73 standardize message object creation (#1986)
* standardize message object creation so i don't flip out again

* fix stuff

* Update Message.js

* Update index.js

* Update SendMessage.js

* Update Message.js
2017-10-29 14:54:00 +01:00
SpaceEEC
0101392334 Documentation improvements (#2069)
* docs: fix documentation in various places

All stores: resolveID returns a nullable Snowflake
GuildAuditLogs: ActionType also can be ALL
MessageEmbed: make files property show up in the docs
ClientApplication: resetSecret and resetToken return a promise
ClientManager: status is readonly
Guild: features is an array of strings and ban no longer accepts a number or string
Guild: ban method no longer accepts a string or number
GuildMember: ^
RichPresenceAssets: small and large Image are Snowflakes, also fixed parameter documentation for small and large image url method
WebhookMessageOptions: file property is no longer a thing

* docs: improve GuildAuditLogs documentation

Prefix types with AuditLog to avoid confusion
Document GuildAuditLogs' static Targets and Actions properties and add necessary typedefs
Use typdefs over primitives where possible.

* fix documentation for Guild#defaultRole
2017-10-28 19:04:03 +02:00
SpaceEEC
d8850dbdd8 feature(Webhook): allow to edit the channel of webhooks (#2039) 2017-10-19 07:01:20 +02:00
Robin B
97823bc376 Various documentation adjustments (#2001)
* docs(various): Add "at" to createdAt description

* docs(Client): Adjust to fit with guilds property

* docs(various): Adjust phrasing & fix typos

* docs(various): Clarifications

* docs(Permissions): fix numerus

* docs(DataStore): capitalize DataStore

* docs(various): Formatting changes

* docs(Presence): Expand RichPresenceAssets docs

* Add space
2017-10-07 01:56:17 +02:00
Gus Caplan
27ccad1f1c tinify webpacks (#1975)
* 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
2017-09-26 07:18:12 +02:00
bdistin
dd085ceaee Datastore cleanup (#1892)
* 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
2017-09-08 23:06:10 +02:00
Robin B
d6b276bc29 refactor(Attachment): Merge MessageAttachment with Attachment (#1894)
* refactor(Attachment): Merge MessageAttachment with Attachment

* refactor(Attachment): Rename setup to _patch for consistency

* refactor(MessageAttachment): Global rename of Attachment class
2017-09-06 23:12:20 +02:00
SpaceEEC
694f78cd43 fix(WebhookClient): use applyToClass instead of multiple inheritance (#1896) 2017-09-06 23:11:40 +02:00
SpaceEEC
c4b5736a16 refactor/fix(DataStores): move instantiating of store related classes into their date stores (#1869)
* refactor/fix(DataStores): move instantiating of store related classes into the relevant create methods and fixed FetchMemberOptions

* Renamed ChannelStore's constructor parameter for claritiy

* define client property before creating items from passed iterable to avoid the client property being undefined

* Fix fetching members with a limit

* add static Channel#create back and moved channel instantiating there

* make ChannelStore's constructor accept an iterable

* make iterable an optional parameter, allow to just pass client and options

* fixed a little typo in docs of <User>.displayAvatarURL() (#1872)

* Rewrite presence a little bit (#1853)

* such presence many good

* Update PresenceStore.js

* Update index.js

* Update ClientPresenceStore.js

* Update Presence.js

* Update ClientPresenceStore.js

* Update ClientUser.js

* Update Presence.js

* add timestamps and party

* Update Presence.js

* Update PresenceStore.js

* Update ClientPresenceStore.js

* Update ClientPresenceStore.js

* fix: made options.type optional in ClientUser#setActivity (#1875)

* fix: made options.type optional in ClientUser#setActivity

* some changes, smol fix

due to too many types being possible, it should just be defaulted to 0. this means streamers will have to set the type manually, though.
also mistake with activity.name check

* docs(Collection): Adjust exists documentation (#1876)

Since the return value of Collection#exists is basically just a boolean of Collection#find's result, the same documentation and arguments can and should be applied.

* refactor(Emoji): remove Guild#deleteEmoji in favour of Emoji#delete (#1877)

* refactor/fix(DataStores): move instantiating of store related classes into the relevant create methods and fixed FetchMemberOptions

* Renamed ChannelStore's constructor parameter for claritiy

* define client property before creating items from passed iterable to avoid the client property being undefined

* Fix fetching members with a limit

* add static Channel#create back and moved channel instantiating there

* make ChannelStore's constructor accept an iterable

* make iterable an optional parameter, allow to just pass client and options

* rebase, this time with saving the file

* address issue with falsy activity throwing errors when setting client's presence
2017-09-03 12:57:49 +02:00
Frangu Vlad
7b6190da01 Fix documentations that were incorrect or missing (#1837)
* Fix docs for Guild#pruneMembers

* ClientApplication returns

* Guild#deleteEmoji

* Guild#setRolePosition takes RoleResolvable

* Client#fetchApplication returns ClientApplication not Oauth2Application

* ClientDataResolver#resolveImage can return null

* ClientApplication#toString small example

* Guild#allowDMs now has a only for user accounts warning

* ClientUserSettings#patch is private and setGuildPosition has a user account warning

* Role#setPermissions can take PermissionResolvable, not just String

* ChannelCreationOverwrites is for a role or a member, not for a "group"

* Fix ChannelData#userlimit string being wrong
"The user limit of voice the channel" :lul:

* ChannelResolvable is only for Channel or Snowflake

* EmojiIdentifierResolvable supports Snowflakes

* UserResolvable doesn't take a guild

* Make patch functions private

* Remove examples

* Webhoox#edit options.name defaults to the webhook name

* Make VoiceConnection functions private

* Am dum
The whole ClientUserSettings category is only for self bots soo

* Value for update functions is *

* Make update functions be private

* Fix GuildEditData missing Ssytemchannel property

* PermissionOverwriteOptions can accept null as an option
(Why did no-one document this?)
2017-08-31 09:16:27 +02:00
SpaceEEC
c4fecf6609 Simplified image resolving and used an options object when creating webhooks (#1843) 2017-08-28 00:11:19 +02:00
Isabella
fbb1253b3f Added resolveImage to reduce code duplication (#1820)
* add client#resolveImage

* oops

* resolveFile fix

* async is the future

* async

* update doc example

* build fix

* doc fix

* fix docs

* thx hydar
2017-08-25 22:17:38 +02:00
Amish Shah
b8315b79c7 Store and Model Refactor (#1618)
* UserStore refactor

* Create ChannelStore, remove redundant methods in ClientDataManager

* Create GuildStore

* Emoji stuff

* Use a Base class where possible to reduce code duplication

* Remove unnecessary comments from ChannelStore

* Add Base._clone();

* Remove unused ClientDataManager methods

* Refactor some more stuff

* ESLint

* Move Client#fetchUser to client.users.fetch

* Remove .has checks and just see if .get is truthy

* Fix guild member chunk error

* ESLint

* Fix typo

* Fix channel storing for user bots

* Remove ClientDataManager

* GuildChannelStore

* Reduce use of Util.cloneObject

* and this one too

* update typings

* Fix MessageUpdate handling (#1507)

* Fix role updates (probably fixes #1525)

* fix for eslint

* Address some of appell's comments

* Use debug constant

* start message store crap if it's ugly tell me later k

* fix that

* message store but works™️

* clean up guild stuff

* clean up channel store stuff

* clean up channel event handling

* does this message stuff work? find out soon in the next episode of dIsCoRd.Js

* eslint

* emojis

* emojis and reactions

* hi my name is eslint and im A LIL SHIT

* so i forgot this huh

* user stuff

* Fix @class

* Fix message stuff

* Fix user store docs

* Document all the bases

* fix the super things

* tidy up remove

* fix textbasedchannel

* fix that too

* fix emoji store

* make voice state stuff less ugly

* make voice states even less ugly

* make members less bad

* fix bug

* fix that too

* fix reactions

* how was this broken for so long

* role store

* remove super._patch from UserConnection

* Rename UserProfile#setup to _patch

* remove unnecessary super calls

* update docgen dep (pls fix travis thx)

* doc messagestore

* fix docs

* message store docs

* things

* DOCS PLS

* more things

* Document TextBasedChannel#messages as a MessageStore

* Rebase

* All the stores!
2017-08-25 21:08:58 +01:00
Isabella
4520c801d3 update attachment & docs (#1815) 2017-08-21 23:11:58 +02:00
iCrawl
2aa2f73c74 Docs cleanup 2017-08-17 20:04:01 +02:00
SpaceEEC
d9262f2682 Added and fixed a bunch of docs stuff (#1767)
- Fixed a common copy paste fail `the the <thing>` in various places
- Apparently I can't type Resolvable correctly,
Fixed that wherever applicable
- Documented GroupDMChannel#nicks so that it will be displayed on the docs
- GroupDMChannel#icon is nullable
- Removed empty InviteOptions typdef, as its properties are now documented in GuildChannel#createInvite
- MessageMentions#channels is no longer nullable
- RoleData#permissions takes a PermissionResolvable or an array of them
- Webhook#avatar is nullable
- Added HTTPOptions typedef and added it to ClientOptions typedef
- ClientUserChannelOverride#muted is for a channel and not a guild directly
2017-08-10 20:31:10 +02:00