Commit Graph

1758 Commits

Author SHA1 Message Date
Frangu Vlad
a832b56469 GuildEmoji: Move all role related functions to a separate store (#2271)
* Prepare to work on moving all role functions to a Store

And yes, this is *another* patch branch cause I messed up my master branch to hell

* Move all emoji role related functions to its own store
Tested everything and it works! (With a reload of the client)
Also had to change a value in DataStore#holds
holds.name for GuildEmojis would return the emoji name instead of the class name

* New Line

* Thanks JS for circular dependency!
Because we can't have nice things...

* Do space's request

* Fix equals

* Fix space's point.

Raw API data has the role property as an array of IDs
2018-01-24 20:47:20 +01:00
Dragon Fire
16b5de5d52 fix(Role) Update usages of highestRole#comparePositionTo to use GuildMemberRoleStore (#2289) 2018-01-24 13:34:11 +01:00
Pascal
048e147497 fix(RoleStore): create method is supposed to take an options object 2018-01-24 09:02:37 +01:00
FireController1847
92c9f8864c Specify that Client#uptime is "in milliseconds" (#2288) 2018-01-24 08:24:24 +01:00
Frangu Vlad
00172e6c7d refactor: Move member role-related functions to a special store (#2242)
* Ignore this I need a patch branch for Git

* Move all member role related stuff to a new DataStore
GuildMemberRoleStore is a new store that holds all member role related stuffs
Because its consistent!

* Minorest doc fix ever
To whoever did this object, they forgot a `{`

* Fix the spacing in the docs

* Resue the stores resolve rather than copy paste
Cause I'm dum and it overwrite resolve to the guild role stores resolve soo

* Fix some requests
- Removed the bs private functions
- Set the roles in the constructor

But, I need feedback. There is no way, that I saw, to make a member have roles whenever GuildMmber#_patch is called,
due to the roles being null on the guild. So the only way might be the for loop and getter.

* Fix an issue that I caused in #add
I was testing some other things, and changed that to test. Forgot to change it back

* Actually make the store generate just once when the member is created by first initializing the roles in the guild
Also replaces GuildMember#_roles with GuildMemberRoleStore#_roles
Tested all functions to make sure the expected result happens.

* I missed this from moving remove from GuildMember to GuildMemberRoleStore

* Fix RoleStore#create docs
For real this time

* Do all the requested changes
- Rename all `somethingRole` to `something` (hoistRole => hoist)
- Refactor add and remove to be cleaner and re-use set

* Fix a bug where the store would loose some roles due to null roles that can throw an error in the for loop after they've been deleted

* Remove the `role.id || role` part of the add and remove functions as Appel suggested

* Replace roles.resolve with roles.resolveID for GuildMemberRoleStore#remove

* Don't use Array.isArray in checks
Use instanceof instead

* Woops, I forgot to change this
Renamed colorRole to color

* The docs have dots, so we place the dots back
2018-01-24 08:12:58 +01:00
Pascal
07c48a6845 fix: require discordjserror to throw meaningful errors where necessary 2018-01-22 20:23:36 +01:00
Cat
8a2ace45d8 docs: fix VoiceBroadcast documentation (#2277) 2018-01-21 18:23:23 +01:00
Michel Nguyen
edc4e2b751 docs: fix streamdispatcher documentation (#2275)
* docs change

* fix streamdispatcher documentation

Signed-off-by: Michel Nguyen <modzongaming@gmail.com>

* fucks sake

Signed-off-by: Michel Nguyen <modzongaming@gmail.com>

* typings

Signed-off-by: Michel Nguyen <modzongaming@gmail.com>

* typings again 👀

Signed-off-by: Michel Nguyen <modzongaming@gmail.com>
2018-01-21 18:23:00 +01:00
Amish Shah
83de7c0d4c Fix error messages 2018-01-21 15:52:32 +00:00
Amish Shah
76891a1e00 try fix 2018-01-21 10:34:14 +00:00
Amish Shah
aa09490724 whoops 2018-01-21 10:31:12 +00:00
Amish Shah
b2708a6fa8 Merge branch 'master' of https://github.com/hydrabolt/discord.js 2018-01-21 10:29:06 +00:00
Amish Shah
0e262ea8d7 More informative stream errors 2018-01-21 10:29:03 +00:00
Pascal
93e083da4f fix(Guild): memberCount not decrementing when an uncached member leaves
This leads to GuildMemberStore#_fetchMany to always reject
because it expects more member than possible.

Also no longer call the GuildMemberRemove handler locally
to not decrement twice.
2018-01-21 07:30:59 +01:00
Kyra
986e6da196 Fix(GuildChannel#clone) options.parent not accepting (falsy) null. (#2262)
* Fixed (falsy) options not being set correctly

* Requested changes.

As a side note, I also default `options.withPermissions` for simplicity, and because it gets ignored in [`GuildChannelStore#create()`](https://discord.js.org/#/docs/main/master/class/GuildChannelStore?scrollTo=create).

* Fixed the overwrites option
2018-01-20 19:30:30 +01:00
Amish Shah
b16e6f8262 Fix VoiceBroadcast#play documentation 2018-01-20 16:57:27 +00:00
Amish Shah
f588b3fd20 Merge branch 'master' into voice-rewrite 2018-01-20 13:50:34 +00:00
Amish Shah
c63bdb5fb1 Remove redundant doc tag descriptions 2018-01-20 13:47:35 +00:00
Amish Shah
ca96e1478a Make docs technically correct 2018-01-20 13:45:22 +00:00
Amish Shah
791740220e Improve docs, allow for webm/opus demuxing and playing broadcasts without specifying a type 2018-01-20 13:01:48 +00:00
Amish Shah
f14193b93a Document examples 2018-01-20 12:48:28 +00:00
Pascal
fbd25f8677 fix(GuildMember): make edit method only modify a copy of the voice state
This is to fix stale members in voice channels.
2018-01-20 12:44:27 +01:00
Pascal
a22b856494 fix(WebSocketConnection): make errors in event handlers throw again
The error from something like client.on('ready', () => undefined.f);
would just be emitted as debug event instead of being thrown.

Simply moving the emitting part out of the try catch again solves this.
2018-01-20 09:05:07 +01:00
Yukine
bf0a68dbac Mark DataStores as public to directly display them in the docs. (#2268)
* make EmojiStore not Private anymore.

because why have something private if there is priority functionality on that class? also that causes that the docs wont show it directly

* make GuildChannelStore not private anymore

because why have something private if there is priority functionality on that class? also that causes that the docs wont show it directly

* make RoleStore not private anymore

because why have something private if there is priority functionality on that class? also that causes that the docs wont show it directly

* make ReactionStore not private anymore

because why have something private if there is priority functionality on that class? also that causes that the docs wont show it directly

* make all non private to stay consistent

* fix merge conflicts because of other PRs.
2018-01-20 08:00:44 +01:00
Amish Shah
ef02bd2935 Add stubs for docs 2018-01-20 00:05:37 +00:00
Amish Shah
2b5fc77a67 Rudimentary support for unified audio playing! 🎉 2018-01-19 23:55:59 +00:00
Amish Shah
8e5e1ad8fe Document Receiver 2018-01-19 23:03:01 +00:00
Amish Shah
c57c2889b7 Fix import errors for networking classes 2018-01-19 22:54:54 +00:00
Amish Shah
066fbfe330 Move voice UDP client and Websocket client to networking folder 2018-01-19 22:53:55 +00:00
Amish Shah
60c5c1486b Remove dead files 2018-01-19 22:51:53 +00:00
Amish Shah
c6c9c0918a Fix PacketHandler runtime error (EventEmitter not imported) 2018-01-19 22:51:26 +00:00
Amish Shah
cb161a8a40 Implement Receiver debug events 2018-01-19 22:47:01 +00:00
Amish Shah
83140f11b7 Fix ESLint and inline the voice readable stream 2018-01-19 22:41:31 +00:00
Amish Shah
dd618584d0 Simplify VolumeInterface constructor 2018-01-19 22:38:39 +00:00
Amish Shah
4a1b55d145 Receiver#createStream should take options 2018-01-19 22:38:10 +00:00
Amish Shah
2c1a302eea Redesign voice receiving, still needs cleaning up 2018-01-19 21:14:03 +00:00
Amish Shah
6058ea4888 Start voice receive rewrite 2018-01-19 17:45:37 +00:00
Amish Shah
580bda46ea Fix documentation for VoiceBroadcast (play methods return BroadcastDispatcher not StreamDispatcher) 2018-01-19 14:40:58 +00:00
Amish Shah
3b1c5d3494 Expose VoiceBroadcast#dispatcher so that the broadcast can be controlled 2018-01-19 14:39:51 +00:00
Amish Shah
e7375aa0fd Reimplement broadcast (un)subscribe events 2018-01-19 14:32:51 +00:00
Schuyler Cebulskie
f649610c26 Merge branch 'master' into voice-rewrite 2018-01-18 19:49:23 -05:00
SpaceEEC
aa3407f705 Base Emoji class for ReactionEmoji and renamed GuildEmoji classes (#2230)
* feat: create base Emoji class for ReactionEmoji and new GuildEmoji

* rename EmojiStore to GuildEmojiStore to account for the new class' name
2018-01-18 02:38:45 -06:00
bdistin
b846cbd2b3 GuildChannel.permissionsFor(role) (#2254)
* GuildChannel.permissionsFor(role)

* 1Comp's requested changes
2018-01-18 02:28:14 -06:00
John Leuenhagen
d5b0cf9ffb Permissions improvements (#2126)
* add Permissions.toArray()

* accept Permissions objects to Permissions.missing()

* accept Permissions as parameter to Permissions.has()

* style fixes

* remove redundant line, update JSDoc for Permission.resolve()

* JSDoc, style, and checkAdmin fixes

* add Permissions.resolveToObject()

* accept PermissionResolvable to Permissions.missing()

* remove `resolveToObject`, fix constructor JSDoc

* remove redundant parameter type

* fix `Permissions.missing()`

* fix checkAdmin

* update Permissions.toArray() description

* eliminate ambiguity in Permissions.toArray() description

* add backticks to permission example

* remove irrelevant type in Permission ctor description

* use this.constructor to properly support OOP

* use simplified approach for Permissions.toArray()

* fix return type on Permissions.toArray()

* move `Permissions#toArray` to more suitable position

* bitwise approach to `Permissions#missing`

* allow `Permissions` to be iterated over

* don't checkAdmin on return array

* remove unnecessary conditional

* fix JSDoc indentation

* use simpler & more reliable approach for missing()

* update PermissionResolvable typedef
2018-01-18 02:17:50 -06:00
Artful
1db0906483 Client method examples. (#2264)
* Client method examples.

* Consistency

* As per hydras request 🙇

* Thanks kya
2018-01-18 07:47:05 +01:00
Michel Nguyen
19591b0bb1 docs: fix attachFiles() docs (#2267)
* docs change

* fix attachFiles docs

* why was this still here
2018-01-18 07:42:05 +01:00
Amish Shah
b94d60d2ab Merge branch 'master' into voice-rewrite 2018-01-16 17:24:07 +00:00
Alex
e576387fea Fix ReactionCollector#remove and make Collector interface more consistent (#2221)
* Fix ReactionCollector#remove and make Collector interface more consistent

* Move those below the doc

* Remove object spread

* Only emit event arguments

* Forgot to delete this line

* Update docs

* Also fix this

* More edits to docs

* Snowflake|string
2018-01-16 01:33:58 +01:00
Isabella
36555c1cea refactor(GuildMember#manageable): refactored kickable and bannable (#2211)
* refactor(GuildMember#manageable): merged kickable and bannable code

* hydar suggestion
2018-01-16 01:32:40 +01:00
bdistin
4122db0275 Return undefined from Collection.find() / findKey() (#2260)
To be compliant with Array.find() / findIndex()
2018-01-16 01:24:19 +01:00