aboutsummaryrefslogtreecommitdiff
path: root/bot.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-07-11 23:14:58 -0400
committerAndrew Lee <alee14498@protonmail.com>2022-07-11 23:14:58 -0400
commit1cd0056d71ab84421b40538ff7b0bb76a2e6a766 (patch)
tree2aa0f2334d68cf3ed8809ce82b87e55b90fd4776 /bot.js
parenteb90e1a4ffbe5f0b82bea296a97786ca5cc81041 (diff)
downloadDLAP-1cd0056d71ab84421b40538ff7b0bb76a2e6a766.tar.gz
DLAP-1cd0056d71ab84421b40538ff7b0bb76a2e6a766.tar.bz2
DLAP-1cd0056d71ab84421b40538ff7b0bb76a2e6a766.zip
Fully implemented order playlist
Diffstat (limited to 'bot.js')
-rw-r--r--bot.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/bot.js b/bot.js
index a8958df..bfcb9f7 100644
--- a/bot.js
+++ b/bot.js
@@ -23,11 +23,11 @@ import { voiceInit } from './AudioBackend.js';
import { readdirSync, readFileSync } from 'node:fs';
import { webServer } from './WebStream.js';
// import config from './config.json' assert { type: 'json' } Not supported by ESLint yet
-const config = JSON.parse(readFileSync('./config.json'));
+const { token, statusChannel, voiceChannel, shuffle } = JSON.parse(readFileSync('./config.json'));
const bot = new Client({ intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_VOICE_STATES'] });
-bot.login(config.token);
+bot.login(token);
// webServer();
@@ -50,8 +50,9 @@ bot.once('ready', async() => {
console.log('Bot is ready!');
console.log(`Logged in as ${bot.user.tag}!`);
console.log(`Running on Discord.JS ${version}`);
- console.log(`Voice Channel: ${config.voiceChannel}`);
- console.log(`Status Channel: ${config.statusChannel}`);
+ console.log(`Voice Channel: ${voiceChannel}`);
+ console.log(`Status Channel: ${statusChannel}`);
+ console.log(`Shuffle enabled: ${shuffle}`);
// Set bots' presence
bot.user.setPresence({
@@ -71,9 +72,9 @@ bot.once('ready', async() => {
.setDescription('Starting bot...')
.setColor('#0066ff');
- const statusChannel = bot.channels.cache.get(config.statusChannel);
- if (!statusChannel) return console.error('The status channel does not exist! Skipping.');
- await statusChannel.send({ embeds: [readyEmbed] });
+ const channel = bot.channels.cache.get(statusChannel);
+ if (!channel) return console.error('The status channel does not exist! Skipping.');
+ await channel.send({ embeds: [readyEmbed] });
return await voiceInit(bot);
});