Several improvements

- Rename Guild#updateChannelPositions -> setChannelPositions
- Allow Guild#setChannelPositions to take ChannelResolvables
- Prioritise ClientDataResolver#resolveChannel's string case
- Minor cleanup
This commit is contained in:
Schuyler Cebulskie
2017-02-25 15:29:32 -05:00
parent 18bcd2f7e2
commit f3a7f59824
7 changed files with 27 additions and 20 deletions

View File

@@ -770,7 +770,15 @@ class RESTMethods {
}
updateChannelPositions(guildID, channels) {
return this.rest.makeRequest('patch', Constants.Endpoints.guildChannels(guildID), true, channels).then(() =>
const data = new Array(channels.length);
for (let i = 0; i < channels.length; i++) {
data[i] = {
id: this.client.resolver.resolveChannelID(channels[i].channel),
position: channels[i].position,
};
}
return this.rest.makeRequest('patch', Constants.Endpoints.guildChannels(guildID), true, data).then(() =>
this.client.actions.GuildChannelsPositionUpdate.handle({
guild_id: guildID,
channels,