mirror of
https://github.com/danbulant/discord.js
synced 2026-06-01 13:52:02 +00:00
fix(GuildMember): add explicit channel resolve error to member edit (#3059)
This commit is contained in:
parent
7bc2e231cf
commit
a0ff72b556
1 changed files with 5 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue