Add audio queue

This commit is contained in:
2021-04-09 13:23:13 +02:00
parent 1fe978eec6
commit 75dc0c2da2
5 changed files with 33 additions and 3 deletions

View File

@@ -1,3 +1,5 @@
const AudioQueue=require('../../AudioQueue.js')
module.exports = function (bot, api) {
bot.on('voiceStateUpdate', async (oldState, newState) => {
if (newState.member.user.bot) return;
@@ -11,6 +13,8 @@ module.exports = function (bot, api) {
let joined = false;
if (!oldState.channel) {
joined = true;
let conn=api.getConnectionForVoiceChannel(channel);
api.queue=new AudioQueue(conn);
}
let username = newState.member.displayName;

View File

@@ -1,10 +1,13 @@
const AudioQueue=require('../../AudioQueue.js')
module.exports = function (bot, api) {
bot.on('ready', async () => {
console.log("Bot initialized and listening");
const guild = await bot.guilds.fetch(process.env.GUILD);
const channel = await bot.channels.fetch(process.env.CHANNEL);
await api.joinChannel(channel);
let conn=api.getConnectionForVoiceChannel(channel);
api.queue=new AudioQueue(conn);
api.speak(channel, `Hey buddies! How does it feel like to be a buddy? Are you proud of being a buddy? Well that's great!'`);
})
}