diff options
| author | Aleksa Vuckovic <aleksa@vuckovic.cc> | 2025-11-11 14:14:48 +0100 |
|---|---|---|
| committer | Your Name <you@example.com> | 2025-11-13 19:07:45 +0100 |
| commit | f10e48a8d8d0cdca589c9d73791b9a46e896425d (patch) | |
| tree | 97055c143dffa352cec1a3e122a9061584a1e324 /src/utils/helpers.js | |
Initial commit
Diffstat (limited to 'src/utils/helpers.js')
| -rw-r--r-- | src/utils/helpers.js | 24 |
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, +}; |
