mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
Handle resolveChannel correctly because it returns a promise
This commit is contained in:
@@ -576,19 +576,21 @@ export default class InternalClient {
|
|||||||
moveMember(user, server, channel) {
|
moveMember(user, server, channel) {
|
||||||
user = this.resolver.resolveUser(user);
|
user = this.resolver.resolveUser(user);
|
||||||
server = this.resolver.resolveServer(server);
|
server = this.resolver.resolveServer(server);
|
||||||
channel = this.resolver.resolveChannel(channel);
|
return this.resolver.resolveChannel(channel).then(channel => {
|
||||||
|
console.log(channel.id);
|
||||||
console.log(channel.type);
|
console.log(channel.name);
|
||||||
// Make sure `channel` is a voice channel
|
console.log(channel.type);
|
||||||
if(channel.type !== "voice") {
|
// Make sure `channel` is a voice channel
|
||||||
throw new Error("Can't moveMember into a non-voice channel");
|
if(channel.type !== "voice") {
|
||||||
} else {
|
throw new Error("Can't moveMember into a non-voice channel");
|
||||||
return this.apiRequest("patch", `${Endpoints.SERVER_MEMBERS(server.id)}/${user.id}`, true, { channel_id: channel.id })
|
} else {
|
||||||
.then(res => {
|
return this.apiRequest("patch", `${Endpoints.SERVER_MEMBERS(server.id)}/${user.id}`, true, { channel_id: channel.id })
|
||||||
user.voiceChannel = channel;
|
.then(res => {
|
||||||
return res;
|
user.voiceChannel = channel;
|
||||||
});
|
return res;
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// def createRole
|
// def createRole
|
||||||
|
|||||||
Reference in New Issue
Block a user