mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
Check before a channel is a voice channel before joining it
This commit is contained in:
@@ -273,6 +273,11 @@ var InternalClient = (function () {
|
|||||||
if (!channel) {
|
if (!channel) {
|
||||||
return Promise.reject(new Error("voice channel does not exist"));
|
return Promise.reject(new Error("voice channel does not exist"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (channel.type !== 'voice') {
|
||||||
|
return Promise.reject(new Error("channel is not a voice channel!"));
|
||||||
|
}
|
||||||
|
|
||||||
return _this3.leaveVoiceChannel().then(function () {
|
return _this3.leaveVoiceChannel().then(function () {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
var session,
|
var session,
|
||||||
|
|||||||
@@ -204,6 +204,11 @@ export default class InternalClient {
|
|||||||
if (!channel) {
|
if (!channel) {
|
||||||
return Promise.reject(new Error("voice channel does not exist"));
|
return Promise.reject(new Error("voice channel does not exist"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (channel.type !== 'voice') {
|
||||||
|
return Promise.reject(new Error("channel is not a voice channel!"));
|
||||||
|
}
|
||||||
|
|
||||||
return this.leaveVoiceChannel()
|
return this.leaveVoiceChannel()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user