Backport: Guild#createChannel (#2145)

* Backport: Guild#createChannel

* this should not return a buffer
This commit is contained in:
Isabella
2017-12-06 00:08:46 -06:00
committed by Crawl
parent d705a0c7d0
commit 862b2ec3d4
4 changed files with 57 additions and 4 deletions

View File

@@ -873,11 +873,19 @@ class Guild {
if (!this.client.user.bot) this.client.syncGuilds([this]);
}
/**
* Can be used to overwrite permissions when creating a channel.
* @typedef {Object} ChannelCreationOverwrites
* @property {PermissionResolvable[]|number} [allow] The permissions to allow
* @property {PermissionResolvable[]|number} [deny] The permissions to deny
* @property {RoleResolvable|UserResolvable} id ID of the role or member this overwrite is for
*/
/**
* Creates a new channel in the guild.
* @param {string} name The name of the new channel
* @param {string} type The type of the new channel, either `text` or `voice` or `category`
* @param {Array<PermissionOverwrites|Object>} [overwrites] Permission overwrites to apply to the new channel
* @param {Array<PermissionOverwrites|ChannelCreationOverwrites>} [overwrites] Permission overwrites
* @param {string} [reason] Reason for creating this channel
* @returns {Promise<TextChannel|VoiceChannel>}
* @example

View File

@@ -155,7 +155,7 @@ class GuildChannel extends Channel {
* @param {Role|Snowflake|UserResolvable} userOrRole The user or role to update
* @param {PermissionOverwriteOptions} options The configuration for the update
* @param {string} [reason] Reason for creating/editing this overwrite
* @returns {Promise}
* @returns {Promise<GuildChannel>}
* @example
* // Overwrite permissions for a message author
* message.channel.overwritePermissions(message.author, {
@@ -203,7 +203,7 @@ class GuildChannel extends Channel {
}
}
return this.client.rest.methods.setChannelOverwrite(this, payload, reason);
return this.client.rest.methods.setChannelOverwrite(this, payload, reason).then(() => this);
}
/**