From f10e48a8d8d0cdca589c9d73791b9a46e896425d Mon Sep 17 00:00:00 2001 From: Aleksa Vuckovic Date: Tue, 11 Nov 2025 14:14:48 +0100 Subject: Initial commit --- src/utils/helpers.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/utils/helpers.js (limited to 'src/utils/helpers.js') diff --git a/src/utils/helpers.js b/src/utils/helpers.js new file mode 100644 index 0000000..f18408f --- /dev/null +++ b/src/utils/helpers.js @@ -0,0 +1,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, +}; -- cgit v1.2.3