mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
fix(GuildMember): add explicit channel resolve error to member edit (#3059)
This commit is contained in:
@@ -508,7 +508,11 @@ class RESTMethods {
|
||||
|
||||
updateGuildMember(member, data, reason) {
|
||||
if (data.channel) {
|
||||
data.channel_id = this.client.resolver.resolveChannel(data.channel).id;
|
||||
const channel = this.client.resolver.resolveChannel(data.channel);
|
||||
if (!channel || channel.guild.id !== member.guild.id || channel.type !== 'voice') {
|
||||
return Promise.reject(new Error('Could not resolve channel to a guild voice channel.'));
|
||||
}
|
||||
data.channel_id = channel.id;
|
||||
data.channel = null;
|
||||
}
|
||||
if (data.roles) data.roles = data.roles.map(role => role instanceof Role ? role.id : role);
|
||||
|
||||
Reference in New Issue
Block a user