function addAudio(client, channelId, guild, audio) {
  // Get queue for the server
  const serverQueue = client.queue.get(guild.id);

  if (!serverQueue) {
    // If there is no queue, join voice channel
    const connection = voice.join(channelId, guild);

    // Create queue and start playing
    createServerQueue(client, guild.id, connection, audio);
    play(client, guild.id, audio);
  } else if (serverQueue && serverQueue.playing === false) {
    // If there is a queue that is not playing, add to it and start again
    serverQueue.audioQueue.push(audio);
    play(client, guild.id, audio);
  } else {
    // If there is a queue that is playing, add to it
    serverQueue.audioQueue.push(audio);
  }

  console.log(`${audio.title} has been added to the queue`);
}
/**
 * Add audio to queue and start playing.
 * If queue is inactive, it will be resumed.
 * If a queue doesn't exist, one will be created.
 * @param {import('../typedefs/discord').DiscordClient} client - Discord client
 * @param {string} channelId - ID of voice channel to join
 * @param {Guild} guild - guild the voice channel belongs to
 * @param {import('../typedefs/audio').Audio} audio - Audio to add to queue
 * @returns {void}
 */
Add audio to queue and start playing.
If queue is inactive, it will be resumed.
If a queue doesn't exist, one will be created.
Add audio to queue and start playing . If queue is inactive it will be resumed . If a queue doesn ' t exist one will be created .
function addAudio(client, channelId, guild, audio) {
  const serverQueue = client.queue.get(guild.id);
  if (!serverQueue) {
    const connection = voice.join(channelId, guild);
    createServerQueue(client, guild.id, connection, audio);
    play(client, guild.id, audio);
  } else if (serverQueue && serverQueue.playing === false) {
    serverQueue.audioQueue.push(audio);
    play(client, guild.id, audio);
  } else {
    serverQueue.audioQueue.push(audio);
  }
  console.log(`${audio.title} has been added to the queue`);
}
function addAudio ( client , channelId , guild , audio ) { const serverQueue = client . queue . get ( guild . id ) ; if ( ! serverQueue ) { const connection = voice . join ( channelId , guild ) ; createServerQueue ( client , guild . id , connection , audio ) ; play ( client , guild . id , audio ) ; } else if ( serverQueue && serverQueue . playing === false ) { serverQueue . audioQueue . push ( audio ) ; play ( client , guild . id , audio ) ; } else { serverQueue . audioQueue . push ( audio ) ; } console . log ( ` ${ audio . title } ` ) ; }
Add audio to queue and start playing.
Add audio to queue and start playing .
// Get queue for the server // If there is no queue, join voice channel // Create queue and start playing // If there is a queue that is not playing, add to it and start again // If there is a queue that is playing, add to it