Commit Graph

172 Commits

Author SHA1 Message Date
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
bdistin
d437cecb3f Fix permission checking for Administrator channel overwrites (#2756) 2018-08-17 08:46:09 +01:00
Amish Shah
edf9c448fb fix: message passing empty data to GuildMember#_patch 2018-08-13 16:49:10 +01:00
Amish Shah
d276850c52 fix: GuildMemberStore now works with custom structures again 2018-08-13 16:21:11 +01: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
Amish Shah
8152841bab Try to cache members from data in message payloads 2018-08-08 12:45:49 +01:00
DennisV2809
47d405e70c Small typo in documentation of Message.js (#2704)
* Update Message.js

message.reply() example fix

* Update Message.js
2018-08-08 12:41:35 +02:00
Isabella
ba32eec7e8 feat(Message): add url getter (#2594)
* feat(Message): add jumpToURL getter

* fix url

* url syntax update

* name to url
2018-07-26 04:38:11 +02:00
bdistin
5afd77ab73 refactor: remove user bot methods (#2559)
* [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
2018-07-25 22:14:23 -04:00
bdistin
037e8cf969 fix(Messages): undeleting themselves (#2570)
when a _patch() is queued
2018-06-16 21:16:57 +02:00
Braxton
f0c4d0e834 feat: Add "deleted" property to multiple structures. (#2556)
* Add "deleted" property to "Message" structure

* Add "deleted" property to Multiple structures

Structures edited:
- Channel
- Emoji
- Guild
- Guild Member
- Role

* Update "deletable" getter

* Fix ESLint "no-trailing-spaces" errors

* Requested Change: Mark w/ bulkDelete
2018-05-28 17:42:51 -05:00
bdistin
8551b8936c docs: fix a number of spelling mistakes (#2469) 2018-04-13 20:50:47 +02: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
Lewdcario
24571e465b docs: examples & improvements 2018-03-01 22:50:45 -06:00
Snazzah
43363172c2 docs: Add TypeDef for MessageActivity (#2321) 2018-02-04 20:44:13 +01:00
Lewdcario
2e0048add1 docs: doc changes 2018-01-27 23:41:25 -06:00
Lewdcario
d93d628f19 make Message#member a getter 2018-01-27 17:04:03 -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
Isabella
45127bb408 docs: improve examples (master branch) (#2209)
* docs: improve examples

* more improvements


fix


maybe this


another example


collectors

* stuff
2018-01-04 01:12:05 +01:00
Alex
59d5c5a947 Don't send files in edit request (#2199) 2017-12-31 20:19:05 +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
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
Jack Baron
b8c70e7935 Typo in Message.awaitReactions docs (#1999) 2017-10-03 12:01:48 +02:00
Dim
97dc85f491 Typo (#1969) 2017-09-25 20:41:50 +02:00
SpaceEEC
ec4c98704f refactor: make use of destructuring for Constants (#1942) 2017-09-16 20:31:36 +02:00
bdistin
ac4b2b3193 Fix GuildMember being undefined (#1915)
* GuildMember being undefined

* tested... not even a circular.
2017-09-09 14:10:57 +02:00
Gus Caplan
67c239b33f update webhook cache and message cache stuff (#1910) 2017-09-08 23:19:30 +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
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
SpaceEEC
b7c55f02c2 Allow Message#edit to accept a MessageEmbed as options parameter (#1844) 2017-08-28 03:05:34 +02:00
SpaceEEC
65d9d46a3c Fixed DataStore, deprecation leftovers and a bit of Event Constants (#1841)
* Fixed leftover fetchThing and removed unused methods/error messages

* Added resume event constant and used event constants wherever possible

* Replaced mentions of removed method name with their new name.

* Fixed typo: resume -> resumed
2017-08-28 00:11:28 +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
iCrawl
2aa2f73c74 Docs cleanup 2017-08-17 20:04:01 +02:00
Gus Caplan
fbdf028b86 :3 (#1774) 2017-08-12 10:58:51 +02:00
Gus Caplan
3ba224900f new application stuff very hype (#1764)
* application stuff, more to come

* docstrings

* Update Message.js
2017-08-11 19:09:06 +02:00
SpaceEEC
48b69c6e2f No longer double increment the reaction count when the client reacts (#1755) 2017-08-10 01:21:34 +02:00
Gus Caplan
963cf42e0d add MessageMentions#has, remove old method (#1724)
* Update MessageMentions.js

* remove old method

* smh

* Update Message.js

* Update MessageMentions.js

* Update MessageMentions.js

* Update MessageMentions.js
2017-08-01 04:49:00 +02:00
Crawl
4adecf4aef rewrite ratelimiting and api route builder (#1667)
* rewrite ratelimiting and api route builder

* more stuff

* let people pass their own handlers

* Update burst.js

* Update RequestHandler.js

* Update burst.js

* Update sequential.js

* Update RequestHandler.js
2017-07-27 03:04:03 +02:00
Crawl
07178a0a2a Revert "rewrite ratelimiting and api route builder (#1667)"
This reverts commit a2eeafc75d.
2017-07-26 23:00:46 +02:00
Gus Caplan
a2eeafc75d rewrite ratelimiting and api route builder (#1667)
* rewrite ratelimiting and api route builder

* more stuff

* let people pass their own handlers

* Update burst.js

* Update RequestHandler.js

* Update burst.js

* Update sequential.js

* Update RequestHandler.js
2017-07-21 02:32:40 +02:00
SpaceEEC
11556c0b3b Moved all error strings to src/errors/messages and a few other things (#1695)
* Added missing error messages
As well as `Guild#setRolePosition` and `Guild#setChannelPosition`'s first arg validation
And fixed a typo in `Guild#setChannelPosition`
`roles` -> `channels`

* Reverted collection and Util constructors

* Removed leftover messages
Should have been in the second commit.

* It's a single invalid permission and removed unused flag error

* Fix INVALID_TOKEN -> TOKEN_INVALID as of #1703
2017-07-21 02:27:19 +02:00
Gus Caplan
39a3e72894 allow content in edit options like in message send options (#1657) 2017-07-05 09:01:07 +01:00
Drahcirius
b1d9084345 Remove RichEmbed in favour of MessageEmbed (#1584)
* remove RichEmbed in favour of MessageEmbed

* fix provider typo
2017-07-04 00:53:22 +02:00
Gus Caplan
5ecd5f7d69 REST API speed improvement (#1577) 2017-07-01 10:14:17 +01:00
Gus Caplan
63e54982f4 Errors Standardization (#1246)
* errors and stuff

* more errors

* all the errors

* fix build
2017-06-25 18:48:05 +01:00
Mythic
fd79539ec3 Improve Message's ID attribute documentation (#1450)
Remove the implication that a Message object's ID is unique only to the channel it was sent on
Message ID's are snowflakes, and as stated in Discord's API documentation, globally unique throughout Discord
2017-06-24 23:21:21 +01:00
SpaceEEC
d6041f9fb3 Added Client#status and Message#type typedefs (#1571)
* typedef for MessageTypes and linked Client#status to Status

* should be singular

* typedef for Voiceconnection#status
2017-06-09 16:27:49 +02:00
Drahcirius
555317043e Message embeds (#1529)
* wowe

* fix sending

* Update MessageEmbed.js

* lel

* patched some fields for message embed and transforms edits as well

* webhook embeds transform

* apply transform to webhook embeds, and changed references

* Update MessageEmbed.js

* Update ClientDataResolver.js

* updated embeds params and use new util resolvers

* did not mean to add this back

* use master version of ClientDataResolver

* transform no longer needed
2017-05-28 03:34:30 +02:00
Drahcirius
4292134647 Refactored static resolvers to Util (#1517)
* ready event will now throw errors properly

* ws login rejection fix

* moved static resolves to util
2017-05-23 12:18:18 +02:00