mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-20 13:33:30 +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) {
|
InternalClient.prototype.joinVoiceChannel = function joinVoiceChannel(chann) {
|
||||||
var _this3 = this;
|
var _this3 = this;
|
||||||
|
|
||||||
var channel = this.resolver.resolveVoiceChannel(chann);
|
return this.resolver.resolveChannel(chann).then(function (channel) {
|
||||||
|
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
return Promise.reject(new Error("voice channel does not exist"));
|
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) {
|
return new Promise(function (resolve, reject) {
|
||||||
var session,
|
var session,
|
||||||
token,
|
token,
|
||||||
@@ -312,6 +311,7 @@ var InternalClient = (function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// def createServer
|
// def createServer
|
||||||
|
|||||||
@@ -236,14 +236,6 @@ var Resolver = (function () {
|
|||||||
return null;
|
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) {
|
Resolver.prototype.resolveChannel = function resolveChannel(resource) {
|
||||||
/*
|
/*
|
||||||
accepts a Message, Channel, Server, String ID, User
|
accepts a Message, Channel, Server, String ID, User
|
||||||
|
|||||||
@@ -200,8 +200,7 @@ export default class InternalClient {
|
|||||||
|
|
||||||
//def joinVoiceChannel
|
//def joinVoiceChannel
|
||||||
joinVoiceChannel(chann) {
|
joinVoiceChannel(chann) {
|
||||||
var channel = this.resolver.resolveVoiceChannel(chann);
|
return this.resolver.resolveChannel(chann).then(channel => {
|
||||||
|
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
return Promise.reject(new Error("voice channel does not exist"));
|
return Promise.reject(new Error("voice channel does not exist"));
|
||||||
}
|
}
|
||||||
@@ -242,6 +241,7 @@ export default class InternalClient {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// def createServer
|
// def createServer
|
||||||
|
|||||||
@@ -166,14 +166,6 @@ export default class Resolver {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
resolveVoiceChannel(resource) {
|
|
||||||
// resolveChannel will also work but this is more apt
|
|
||||||
if (resource instanceof VoiceChannel) {
|
|
||||||
return resource;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
resolveChannel(resource) {
|
resolveChannel(resource) {
|
||||||
/*
|
/*
|
||||||
accepts a Message, Channel, Server, String ID, User
|
accepts a Message, Channel, Server, String ID, User
|
||||||
|
|||||||
Reference in New Issue
Block a user