Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #457. You know, some of these were introduced years ago, but this function has barely changed.
- Loading branch information
1 parent
86ee584
commit 97bd436
Showing
1 changed file
with
22 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -357,16 +357,32 @@ class Client extends EventEmitter { | |
* @arg {String} name The name of the channel | ||
* @arg {String} [type=0] The type of the channel, either 0 (text), 2 (voice), or 4 (category) | ||
* @arg {String} [reason] The reason to be displayed in audit logs | ||
* @arg {String} [parentID] ID of the parent category for a channel | ||
* @arg {Object} [options] The properties the channel should have | ||
* @arg {String} [options.topic] The topic of the channel (text channels only) | ||
* @arg {Boolean} [options.nsfw] The nsfw status of the channel | ||
* @arg {Number} [options.bitrate] The bitrate of the channel (voice channels only) | ||
* @arg {Number} [options.userLimit] The channel user limit (voice channels only) | ||
* @arg {Number} [options.rateLimitPerUser] The time in seconds a user has to wait before sending another message (does not affect bots or users with manageMessages/manageChannel permissions) (text channels only) | ||
* @arg {String?} [options.parentID] The ID of the parent channel category for this channel | ||
* @returns {Promise<CategoryChannel | TextChannel | VoiceChannel>} | ||
*/ | ||
createChannel(guildID, name, type, reason, parentID) { | ||
createChannel(guildID, name, type, reason, options = {}) { | ||
const guild = this.guilds.get(guildID); | ||
if(typeof options === "string") { // This used to be parentID, back-compat | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
LJNeon
Contributor
|
||
options = { | ||
parentID: options | ||
}; | ||
} | ||
return this.requestHandler.request("POST", Endpoints.GUILD_CHANNELS(guildID), true, { | ||
name, | ||
type, | ||
reason, | ||
parent_id: parentID | ||
name: name, | ||
type: type, | ||
reason: reason, | ||
topic: options.topic, | ||
nsfw: options.nsfw, | ||
bitrate: options.bitrate, | ||
user_limit: options.userLimit, | ||
rate_limit_per_user: options.rateLimitPerUser, | ||
parent_id: options.parentID | ||
}).then((channel) => { | ||
if(channel.type === 0) { | ||
return new TextChannel(channel, guild); | ||
|
Do we really want to have this? Can always bump major, since without it it's breaking, and we've got a quite a few things in the dev branch anyway.