Compare commits
No commits in common. "591eb227b311d138a4bd36a7fdd6b365cdd55c1b" and "4a371cf4d6d8f8dfa9cd80d246efd79ee2f45f98" have entirely different histories.
591eb227b3
...
4a371cf4d6
|
@ -1,5 +1,5 @@
|
||||||
const printf = require('printf');
|
const printf=require('printf');
|
||||||
const AudioQueue = require('../../AudioQueue.js')
|
const AudioQueue=require('../../AudioQueue.js')
|
||||||
|
|
||||||
module.exports = function (bot, api) {
|
module.exports = function (bot, api) {
|
||||||
bot.on('voiceStateUpdate', async (oldState, newState) => {
|
bot.on('voiceStateUpdate', async (oldState, newState) => {
|
||||||
|
@ -8,16 +8,14 @@ module.exports = function (bot, api) {
|
||||||
const channel = oldState.channel || newState.channel;
|
const channel = oldState.channel || newState.channel;
|
||||||
if (!channel) return;
|
if (!channel) return;
|
||||||
if (channel.members.size < 2) {
|
if (channel.members.size < 2) {
|
||||||
api.AudioQueue.flush();
|
return await api.leaveChannel(channel);
|
||||||
await api.leaveChannel(channel);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
await api.joinChannel(channel);
|
await api.joinChannel(channel);
|
||||||
let joined = false;
|
let joined = false;
|
||||||
if (!oldState.channel) {
|
if (!oldState.channel) {
|
||||||
joined = true;
|
joined = true;
|
||||||
let conn = api.getConnectionForVoiceChannel(channel);
|
let conn=api.getConnectionForVoiceChannel(channel);
|
||||||
if (!api.queue) api.queue = new AudioQueue(conn, api);
|
if (!api.queue) api.queue=new AudioQueue(conn, api);
|
||||||
}
|
}
|
||||||
|
|
||||||
let username = newState.member.displayName;
|
let username = newState.member.displayName;
|
||||||
|
|
Loading…
Reference in New Issue