aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-03-29 00:03:42 -0400
committerAndrew Lee <alee14498@protonmail.com>2022-03-29 00:03:42 -0400
commit18f0b9d60c44f69fad6eb4716659c79f08f46711 (patch)
tree9f18c1753bfb3fd695a0cc26068d3dc1515cb153
parent08aae8cd9e5417bd7451b9af2e3190bf9c6a4e43 (diff)
downloadDLAP-18f0b9d60c44f69fad6eb4716659c79f08f46711.tar.gz
DLAP-18f0b9d60c44f69fad6eb4716659c79f08f46711.tar.bz2
DLAP-18f0b9d60c44f69fad6eb4716659c79f08f46711.zip
Permission system on certain commands
-rw-r--r--AudioBackend.js4
-rw-r--r--bot.js2
-rw-r--r--commands/control.js3
-rw-r--r--commands/join.js2
-rw-r--r--commands/list.js6
-rw-r--r--commands/stop.js1
-rw-r--r--deploy-command.js2
7 files changed, 11 insertions, 9 deletions
diff --git a/AudioBackend.js b/AudioBackend.js
index c53c57e..e3e31cc 100644
--- a/AudioBackend.js
+++ b/AudioBackend.js
@@ -43,7 +43,7 @@ export function voiceInit(bot) {
});
connection.on(VoiceConnectionStatus.Ready, () => {
- console.log('Ready to blast music!');
+ console.log('Ready to blast some beats!');
});
connection.on(VoiceConnectionStatus.Destroyed, () => {
@@ -51,7 +51,7 @@ export function voiceInit(bot) {
});
player.on('idle', () => {
- console.log("Music has finished playing, shuffling music...")
+ console.log("Music has finished playing, shuffling the beats...")
playAudio(bot);
})
diff --git a/bot.js b/bot.js
index 47ef48c..f0a9c63 100644
--- a/bot.js
+++ b/bot.js
@@ -52,8 +52,6 @@ bot.once('ready', () => {
console.log(`Voice Channel: ${config.voiceChannel}`);
console.log(`Status Channel: ${config.statusChannel}`);
console.log(`Owner ID: ${config.botOwner}`);
- console.log(`Guild ID: ${config.guildID}`);
- console.log(`Client ID: ${config.clientID}\n`);
// Set bots' presence
bot.user.setPresence({
diff --git a/commands/control.js b/commands/control.js
index b3dd0bf..28c3aad 100644
--- a/commands/control.js
+++ b/commands/control.js
@@ -30,8 +30,9 @@ export default {
.setName('control')
.setDescription('Controlling the music'),
async execute(interaction, bot) {
+ if (![config.botOwner].includes(interaction.user.id)) return await interaction.reply({ content: "You do not have permissions to execute this command.", ephemeral: true });
const controlEmbed = new MessageEmbed()
- .setAuthor({name:`${bot.user.username} Control Panel`, iconURL:bot.user.avatarURL()})
+ .setAuthor({name: `${bot.user.username} Control Panel`, iconURL: bot.user.avatarURL()})
.addField('State', 'Playing')
.addField('Currently Playing', audio)
//.addField('Next Music', '(a possible feature when queue system is implemented?)')
diff --git a/commands/join.js b/commands/join.js
index 45f513c..8778aae 100644
--- a/commands/join.js
+++ b/commands/join.js
@@ -21,12 +21,14 @@
import { SlashCommandBuilder } from '@discordjs/builders'
import { voiceInit } from "../AudioBackend.js";
+import config from '../config.json' assert {type: 'json'}
export default {
data: new SlashCommandBuilder()
.setName('join')
.setDescription('Joins voice chat.'),
async execute(interaction, bot) {
+ if (![config.botOwner].includes(interaction.user.id)) return await interaction.reply({ content: "You do not have permissions to execute this command.", ephemeral: true });
await interaction.reply('Joining voice channel')
voiceInit(bot);
},
diff --git a/commands/list.js b/commands/list.js
index 00c984e..4ec7156 100644
--- a/commands/list.js
+++ b/commands/list.js
@@ -29,9 +29,9 @@ export default {
.setName('list')
.setDescription('Lists the available audio tracks'),
async execute(interaction) {
- /*
+ interaction.reply('Listing the available audio tracks...');
fs.readdirSync(musicFolder).forEach(file => {
- return interaction.reply('Listing the available audio tracks...\n' + file);
- });*/
+ console.log(file);
+ });
},
}; \ No newline at end of file
diff --git a/commands/stop.js b/commands/stop.js
index 3059997..62f4b1a 100644
--- a/commands/stop.js
+++ b/commands/stop.js
@@ -29,6 +29,7 @@ export default {
.setName('stop')
.setDescription('Powers off the bot'),
async execute(interaction, bot) {
+ if (![config.botOwner].includes(interaction.user.id)) return await interaction.reply({ content: "You do not have permissions to execute this command.", ephemeral: true });
await interaction.reply('Powering off...')
const statusEmbed = new MessageEmbed()
diff --git a/deploy-command.js b/deploy-command.js
index c85637f..9386556 100644
--- a/deploy-command.js
+++ b/deploy-command.js
@@ -11,7 +11,7 @@ for (const file of commandFiles) {
commands.push(command.data.toJSON());
}
-const rest = new REST({ version: '9' }).setToken(config.token);
+const rest = new REST({ version: '10' }).setToken(config.token);
rest.put(Routes.applicationGuildCommands(config.clientID, config.guildID), { body: commands })
.then(() => console.log('Successfully registered application commands.'))