summaryrefslogtreecommitdiff
path: root/src/utils/helpers.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/helpers.js')
-rw-r--r--src/utils/helpers.js24
1 files changed, 24 insertions, 0 deletions
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,
+};