mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
feature(CategoryChannel): backport (#2117)
* feature(CategoryChannel): backport fix no * ???? * bad ternary
This commit is contained in:
committed by
Schuyler Cebulskie
parent
b274dba6ec
commit
cce2480bb5
@@ -2,6 +2,7 @@ const Constants = require('../util/Constants');
|
||||
const Util = require('../util/Util');
|
||||
const Guild = require('../structures/Guild');
|
||||
const User = require('../structures/User');
|
||||
const CategoryChannel = require('../structures/CategoryChannel');
|
||||
const DMChannel = require('../structures/DMChannel');
|
||||
const Emoji = require('../structures/Emoji');
|
||||
const TextChannel = require('../structures/TextChannel');
|
||||
@@ -61,6 +62,9 @@ class ClientDataManager {
|
||||
} else if (data.type === Constants.ChannelTypes.VOICE) {
|
||||
channel = new VoiceChannel(guild, data);
|
||||
guild.channels.set(channel.id, channel);
|
||||
} else if (data.type === Constants.ChannelTypes.CATEGORY) {
|
||||
channel = new CategoryChannel(guild, data);
|
||||
guild.channels.set(channel.id, channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ class RESTMethods {
|
||||
if (overwrites instanceof Collection) overwrites = overwrites.array();
|
||||
return this.rest.makeRequest('post', Endpoints.Guild(guild).channels, true, {
|
||||
name: channelName,
|
||||
type: channelType,
|
||||
type: Constants.ChannelTypes[channelType.toUpperCase()],
|
||||
permission_overwrites: overwrites,
|
||||
}, undefined, reason).then(data => this.client.actions.ChannelCreate.handle(data).channel);
|
||||
}
|
||||
@@ -320,6 +320,7 @@ class RESTMethods {
|
||||
data.position = _data.position || channel.position;
|
||||
data.bitrate = _data.bitrate || channel.bitrate;
|
||||
data.user_limit = _data.userLimit || channel.userLimit;
|
||||
data.parent_id = _data.parent || (channel.parent ? channel.parent.id : undefined);
|
||||
return this.rest.makeRequest('patch', Endpoints.Channel(channel), true, data, undefined, reason).then(newData =>
|
||||
this.client.actions.ChannelUpdate.handle(newData).updated
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user