mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
fix(GuildChannel): add explicit channel resolve error to member edit (#2958)
* Add explicit error to setting invalid voice channel * restrict to guild Co-Authored-By: Darqam <anhim2@gmail.com> * add a more explicit error and channel type check * bad tab
This commit is contained in:
@@ -248,7 +248,11 @@ class GuildMember extends Base {
|
||||
*/
|
||||
edit(data, reason) {
|
||||
if (data.channel) {
|
||||
data.channel_id = this.client.channels.resolve(data.channel).id;
|
||||
data.channel = this.guild.channels.resolve(data.channel);
|
||||
if (!data.channel || data.channel.type !== 'voice') {
|
||||
throw new Error('GUILD_VOICE_CHANNEL_RESOLVE');
|
||||
}
|
||||
data.channel_id = data.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