mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
Permissions Cleanup (#1643)
* fix Permissions.add/remove, by completely changing what they do
* permissions cleanup
Removes overwrite._denied and overwrite._allowed in favor of overwrite.denied.bitfield and overwrite.allowed.bitfield
uses the modified Permissions.add and Permissions.remove to clean up existing code
fixes GuildMember.missingPermissions
changes Permissions add/remove to reverse loops for speed, changes resolve to allow the number 0 as a valid permission.
* Revert createChannel overwrite.allow / overwrite.deny for arrays of {allow:bitfield, deny:bitfield}
Documentation should be improved here, although I would need advice. I believe a overwrite object typedef is needed, to show the structure of the object, and also include that collections may be used for this, rather than arrays.
* api router fix for overwritePermissions
* add Permissions.freeze, and change all returned Permissions to immutable instances
* Make Permissions a permission resolveable
change role.permissions to be an instance of Permissions
* Make permissions.add/remove return a new instance if the instance is frozen
* Fix invalid error
* Update GuildChannel.js
* Update Guild.js
* fix bad merge
This commit is contained in:
@@ -905,8 +905,8 @@ class Guild extends Base {
|
||||
createChannel(name, type, { overwrites, reason } = {}) {
|
||||
if (overwrites instanceof Collection || overwrites instanceof Array) {
|
||||
overwrites = overwrites.map(overwrite => {
|
||||
let allow = overwrite.allow || overwrite._allowed;
|
||||
let deny = overwrite.deny || overwrite._denied;
|
||||
let allow = overwrite.allow || overwrite.allowed.bitfield;
|
||||
let deny = overwrite.deny || overwrite.denied.bitfield;
|
||||
if (allow instanceof Array) allow = Permissions.resolve(allow);
|
||||
if (deny instanceof Array) deny = Permissions.resolve(deny);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user