Correctly mapping overwrites when creating a channel and renamed all relevant property names as of #1562 (#1570)

* using correct properties to apply permissionOverwrites

and fixed `GuildChannel#clone`

* also arrays should be mapped and correct properties taking priority

* changed .deny and .allow to .denied and .allowed respectively

* whoops
This commit is contained in:
SpaceEEC
2017-06-16 12:49:13 +02:00
committed by Crawl
parent 35e8601b3a
commit 00eebd34cb
2 changed files with 18 additions and 11 deletions

View File

@@ -843,7 +843,14 @@ class Guild {
* .catch(console.error);
*/
createChannel(name, type, { overwrites, reason } = {}) {
if (overwrites instanceof Collection) overwrites = overwrites.array();
if (overwrites instanceof Collection || overwrites instanceof Array) {
overwrites = overwrites.map(overwrite => ({
allow: overwrite.allow || overwrite._allowed,
deny: overwrite.deny || overwrite._denied,
type: overwrite.type,
id: overwrite.id,
}));
}
return this.client.api.guilds(this.id).channels.post({
data: {
name, type, permission_overwrites: overwrites,