aboutsummaryrefslogtreecommitdiff
path: root/bot.js
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-07-09 22:14:38 -0400
committerAndrew Lee <alee14498@protonmail.com>2022-07-09 22:14:38 -0400
commitd7e4cf29e6fc6b8f4ba07e837dcf56b3f5d63afc (patch)
treea6fd714025ec7fe78bd89d45d7f0fa36bc8f73aa /bot.js
parent4c26fbcb7e1674d5ccbb5468a32cd4a2bc2a315b (diff)
downloadDLAP-d7e4cf29e6fc6b8f4ba07e837dcf56b3f5d63afc.tar.gz
DLAP-d7e4cf29e6fc6b8f4ba07e837dcf56b3f5d63afc.tar.bz2
DLAP-d7e4cf29e6fc6b8f4ba07e837dcf56b3f5d63afc.zip
ESLint
Diffstat (limited to 'bot.js')
-rw-r--r--bot.js35
1 files changed, 17 insertions, 18 deletions
diff --git a/bot.js b/bot.js
index 75a217c..69df79b 100644
--- a/bot.js
+++ b/bot.js
@@ -1,9 +1,9 @@
/**************************************************************************
- *
+ *
* DLAP Bot: A Discord bot that plays local audio tracks.
* (C) Copyright 2022
- * Programmed by Andrew Lee
- *
+ * Programmed by Andrew Lee
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -16,18 +16,18 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
+ *
***************************************************************************/
-import { Client, MessageEmbed, Collection, version } from 'discord.js'
-import { voiceInit } from './AudioBackend.js'
-import { readdirSync } from 'node:fs'
-import config from './config.json' assert { type: 'json' }
+import { Client, MessageEmbed, Collection, version } from 'discord.js';
+import { voiceInit } from './AudioBackend.js';
+import { readdirSync, readFileSync } from 'node:fs';
+// import config from './config.json' assert { type: 'json' } Not in ECMAScript yet
+const config = JSON.parse(readFileSync('./config.json'));
-const bot = new Client({intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_VOICE_STATES']});
+const bot = new Client({ intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_VOICE_STATES'] });
bot.login(config.token);
-
/**
* Project Ideas:
* Shuffle or "Play by order" mode
@@ -47,7 +47,7 @@ for (const file of commandFiles) {
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(`Running on Discord.JS ${version}`);
console.log(`Voice Channel: ${config.voiceChannel}`);
console.log(`Status Channel: ${config.statusChannel}`);
@@ -57,7 +57,7 @@ bot.once('ready', async () => {
name: 'some beats',
type: 'LISTENING'
}],
- status: 'online',
+ status: 'online'
});
const activity = bot.presence.activities[0];
@@ -65,16 +65,15 @@ bot.once('ready', async () => {
// Send bots' status to channel
const readyEmbed = new MessageEmbed()
- .setAuthor({name: bot.user.username, iconURL: bot.user.avatarURL()})
- .setDescription('Starting bot...')
- .setColor('#0066ff')
+ .setAuthor({ name: bot.user.username, iconURL: bot.user.avatarURL() })
+ .setDescription('Starting bot...')
+ .setColor('#0066ff');
- let statusChannel = bot.channels.cache.get(config.statusChannel);
+ 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]});
+ await statusChannel.send({ embeds: [readyEmbed] });
await voiceInit(bot);
-
});
bot.on('interactionCreate', async interaction => {