mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-20 21:43:33 +01:00
Use resolveChannel instead of resolveVoiceChannel for joinVoiceChannel and get rid of resolveVoiceChannel
This commit is contained in:
@@ -269,12 +269,11 @@ var InternalClient = (function () {
|
||||
InternalClient.prototype.joinVoiceChannel = function joinVoiceChannel(chann) {
|
||||
var _this3 = this;
|
||||
|
||||
var channel = this.resolver.resolveVoiceChannel(chann);
|
||||
|
||||
return this.resolver.resolveChannel(chann).then(function (channel) {
|
||||
if (!channel) {
|
||||
return Promise.reject(new Error("voice channel does not exist"));
|
||||
}
|
||||
return this.leaveVoiceChannel().then(function () {
|
||||
return _this3.leaveVoiceChannel().then(function () {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var session,
|
||||
token,
|
||||
@@ -312,6 +311,7 @@ var InternalClient = (function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// def createServer
|
||||
|
||||
@@ -236,14 +236,6 @@ var Resolver = (function () {
|
||||
return null;
|
||||
};
|
||||
|
||||
Resolver.prototype.resolveVoiceChannel = function resolveVoiceChannel(resource) {
|
||||
// resolveChannel will also work but this is more apt
|
||||
if (resource instanceof _StructuresVoiceChannel2["default"]) {
|
||||
return resource;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
Resolver.prototype.resolveChannel = function resolveChannel(resource) {
|
||||
/*
|
||||
accepts a Message, Channel, Server, String ID, User
|
||||
|
||||
@@ -200,8 +200,7 @@ export default class InternalClient {
|
||||
|
||||
//def joinVoiceChannel
|
||||
joinVoiceChannel(chann) {
|
||||
var channel = this.resolver.resolveVoiceChannel(chann);
|
||||
|
||||
return this.resolver.resolveChannel(chann).then(channel => {
|
||||
if (!channel) {
|
||||
return Promise.reject(new Error("voice channel does not exist"));
|
||||
}
|
||||
@@ -242,6 +241,7 @@ export default class InternalClient {
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// def createServer
|
||||
|
||||
@@ -166,14 +166,6 @@ export default class Resolver {
|
||||
return null;
|
||||
}
|
||||
|
||||
resolveVoiceChannel(resource) {
|
||||
// resolveChannel will also work but this is more apt
|
||||
if (resource instanceof VoiceChannel) {
|
||||
return resource;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
resolveChannel(resource) {
|
||||
/*
|
||||
accepts a Message, Channel, Server, String ID, User
|
||||
|
||||
Reference in New Issue
Block a user