aboutsummaryrefslogtreecommitdiff
path: root/Commands/join.js
diff options
context:
space:
mode:
Diffstat (limited to 'Commands/join.js')
-rw-r--r--Commands/join.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/Commands/join.js b/Commands/join.js
index 739ebba..2649784 100644
--- a/Commands/join.js
+++ b/Commands/join.js
@@ -22,14 +22,17 @@
import { SlashCommandBuilder } from 'discord.js';
import { voiceInit } from '../AudioBackend/VoiceInitialization.js';
import { PermissionFlagsBits } from 'discord-api-types/v10';
+import { readFileSync } from 'node:fs';
+const { djRole, ownerID } = JSON.parse(readFileSync('./config.json', 'utf-8'));
export default {
data: new SlashCommandBuilder()
.setName('join')
- .setDescription('Joins voice chat')
- .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
+ .setDescription('Joins voice chat'),
async execute(interaction, bot) {
if (!interaction.member.voice.channel) return await interaction.reply({ content: 'You need to be in a voice channel to use this command.', ephemeral: true });
+ if (!interaction.member.roles.cache.has(djRole) && interaction.user.id !== ownerID && !interaction.member.permission.has(PermissionFlagsBits.ManageGuild)) return interaction.reply({ content: 'You need a specific role to execute this command', ephemeral: true });
+
await interaction.reply({ content: 'Joining voice channel', ephemeral: true });
return await voiceInit(bot);
}