chore: consistency/prettier (#3852)

* chore: consistency/prettier

* chore: rebase

* chore: rebase

* chore: include typings

* fix: include typings file in prettier lint-staged
This commit is contained in:
Crawl
2020-02-29 14:35:57 +01:00
committed by GitHub
parent 6650d50a56
commit c065156a88
127 changed files with 5198 additions and 4513 deletions

View File

@@ -1,9 +1,9 @@
'use strict';
const Role = require('./Role');
const { TypeError } = require('../errors');
const Permissions = require('../util/Permissions');
const Util = require('../util/Util');
const { TypeError } = require('../errors');
/**
* Represents a permission overwrite for a role or member in a guild channel.
@@ -70,8 +70,12 @@ class PermissionOverwrites {
update(options, reason) {
const { allow, deny } = this.constructor.resolveOverwriteOptions(options, this);
return this.channel.client.api.channels(this.channel.id).permissions[this.id]
.put({ data: { id: this.id, type: this.type, allow: allow.bitfield, deny: deny.bitfield }, reason })
return this.channel.client.api
.channels(this.channel.id)
.permissions[this.id].put({
data: { id: this.id, type: this.type, allow: allow.bitfield, deny: deny.bitfield },
reason,
})
.then(() => this);
}
@@ -81,9 +85,7 @@ class PermissionOverwrites {
* @returns {Promise<PermissionOverwrites>}
*/
delete(reason) {
return this.channel.client.api.channels[this.channel.id].permissions[this.id]
.delete({ reason })
.then(() => this);
return this.channel.client.api.channels[this.channel.id].permissions[this.id].delete({ reason }).then(() => this);
}
toJSON() {
@@ -168,10 +170,7 @@ class PermissionOverwrites {
static resolve(overwrite, guild) {
if (overwrite instanceof this) return overwrite.toJSON();
if (typeof overwrite.id === 'string' && ['role', 'member'].includes(overwrite.type)) {
return { ...overwrite,
allow: Permissions.resolve(overwrite.allow),
deny: Permissions.resolve(overwrite.deny),
};
return { ...overwrite, allow: Permissions.resolve(overwrite.allow), deny: Permissions.resolve(overwrite.deny) };
}
const userOrRole = guild.roles.resolve(overwrite.id) || guild.client.users.resolve(overwrite.id);