mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
fix(Guild#createChannel): default type to 'text' (#2184)
* fix(Guild#createChannel): default type to 'text' * gus suggestion
This commit is contained in:
@@ -910,8 +910,8 @@ class Guild extends Base {
|
|||||||
/**
|
/**
|
||||||
* Creates a new channel in the guild.
|
* Creates a new channel in the guild.
|
||||||
* @param {string} name The name of the new channel
|
* @param {string} name The name of the new channel
|
||||||
* @param {string} type The type of the new channel, either `text`, `voice`, or `category`
|
|
||||||
* @param {Object} [options] Options
|
* @param {Object} [options] Options
|
||||||
|
* @param {string} [options.type='text'] The type of the new channel, either `text`, `voice`, or `category`
|
||||||
* @param {boolean} [options.nsfw] Whether the new channel is nsfw
|
* @param {boolean} [options.nsfw] Whether the new channel is nsfw
|
||||||
* @param {number} [options.bitrate] Bitrate of the new channel in bits (only voice)
|
* @param {number} [options.bitrate] Bitrate of the new channel in bits (only voice)
|
||||||
* @param {number} [options.userLimit] Maximum amount of users allowed in the new channel (only voice)
|
* @param {number} [options.userLimit] Maximum amount of users allowed in the new channel (only voice)
|
||||||
@@ -925,7 +925,7 @@ class Guild extends Base {
|
|||||||
* .then(channel => console.log(`Created new channel ${channel}`))
|
* .then(channel => console.log(`Created new channel ${channel}`))
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
createChannel(name, type, { nsfw, bitrate, userLimit, parent, overwrites, reason } = {}) {
|
createChannel(name, { type, nsfw, bitrate, userLimit, parent, overwrites, reason } = {}) {
|
||||||
if (overwrites instanceof Collection || overwrites instanceof Array) {
|
if (overwrites instanceof Collection || overwrites instanceof Array) {
|
||||||
overwrites = overwrites.map(overwrite => {
|
overwrites = overwrites.map(overwrite => {
|
||||||
let allow = overwrite.allow || (overwrite.allowed ? overwrite.allowed.bitfield : 0);
|
let allow = overwrite.allow || (overwrite.allowed ? overwrite.allowed.bitfield : 0);
|
||||||
@@ -955,7 +955,7 @@ class Guild extends Base {
|
|||||||
return this.client.api.guilds(this.id).channels.post({
|
return this.client.api.guilds(this.id).channels.post({
|
||||||
data: {
|
data: {
|
||||||
name,
|
name,
|
||||||
type: ChannelTypes[type.toUpperCase()],
|
type: type ? ChannelTypes[type.toUpperCase()] : 'text',
|
||||||
nsfw,
|
nsfw,
|
||||||
bitrate,
|
bitrate,
|
||||||
user_limit: userLimit,
|
user_limit: userLimit,
|
||||||
|
|||||||
Reference in New Issue
Block a user