mirror of
https://github.com/danbulant/discord.js
synced 2026-06-19 14:41:36 +00:00
Check before a channel is a voice channel before joining it
This commit is contained in:
parent
e66311bdf5
commit
c773ea4e49
2 changed files with 10 additions and 0 deletions
|
|
@ -273,6 +273,11 @@ var InternalClient = (function () {
|
|||
if (!channel) {
|
||||
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 new Promise(function (resolve, reject) {
|
||||
var session,
|
||||
|
|
|
|||
|
|
@ -204,6 +204,11 @@ export default class InternalClient {
|
|||
if (!channel) {
|
||||
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()
|
||||
.then(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue