mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user