summaryrefslogtreecommitdiff
path: root/src/utils/helpers.js
blob: f18408f4f02de8d4a9e1ea2207f7a0595823a672 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function getQueueOrReply(interaction, queues, message = 'Not in a voice channel!') {
  const queue = queues.get(interaction.guild.id);
  
  if (!queue) {
    interaction.reply(message);
    return null;
  }
  
  return queue;
}

function requireVoiceChannel(interaction) {
  if (!interaction.member?.voice?.channel) {
    interaction.editReply('You need to be in a voice channel!');
    return null;
  }
  
  return interaction.member.voice.channel;
}

module.exports = {
  getQueueOrReply,
  requireVoiceChannel,
};