mirror of
https://github.com/danbulant/discord.js
synced 2026-09-18 05:54:20 +00:00
Handle resolveChannel correctly because it returns a promise
This commit is contained in:
parent
042d7d1dbe
commit
59060b27e6
1 changed files with 15 additions and 13 deletions
|
|
@ -576,19 +576,21 @@ export default class InternalClient {
|
|||
moveMember(user, server, channel) {
|
||||
user = this.resolver.resolveUser(user);
|
||||
server = this.resolver.resolveServer(server);
|
||||
channel = this.resolver.resolveChannel(channel);
|
||||
|
||||
console.log(channel.type);
|
||||
// Make sure `channel` is a voice channel
|
||||
if(channel.type !== "voice") {
|
||||
throw new Error("Can't moveMember into a non-voice channel");
|
||||
} else {
|
||||
return this.apiRequest("patch", `${Endpoints.SERVER_MEMBERS(server.id)}/${user.id}`, true, { channel_id: channel.id })
|
||||
.then(res => {
|
||||
user.voiceChannel = channel;
|
||||
return res;
|
||||
});
|
||||
}
|
||||
return this.resolver.resolveChannel(channel).then(channel => {
|
||||
console.log(channel.id);
|
||||
console.log(channel.name);
|
||||
console.log(channel.type);
|
||||
// Make sure `channel` is a voice channel
|
||||
if(channel.type !== "voice") {
|
||||
throw new Error("Can't moveMember into a non-voice channel");
|
||||
} else {
|
||||
return this.apiRequest("patch", `${Endpoints.SERVER_MEMBERS(server.id)}/${user.id}`, true, { channel_id: channel.id })
|
||||
.then(res => {
|
||||
user.voiceChannel = channel;
|
||||
return res;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// def createRole
|
||||
|
|
|
|||
Loading…
Reference in a new issue