aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2022-07-10 01:05:59 -0400
committerAndrew Lee <alee14498@protonmail.com>2022-07-10 01:05:59 -0400
commit626cef85162b08c1808d8f88b5b245060ff0dd54 (patch)
tree7a1c6acfd3e2667fadafcff1536d55589b71d3da
parente5020f2c6231f11785725e286c5155fcbeeaccd7 (diff)
downloadDLAP-626cef85162b08c1808d8f88b5b245060ff0dd54.tar.gz
DLAP-626cef85162b08c1808d8f88b5b245060ff0dd54.tar.bz2
DLAP-626cef85162b08c1808d8f88b5b245060ff0dd54.zip
Added another eslint rule
-rw-r--r--.eslintrc.json3
-rw-r--r--AudioBackend.js20
-rw-r--r--bot.js4
-rw-r--r--commands/about.js2
-rw-r--r--commands/join.js2
-rw-r--r--commands/leave.js2
-rw-r--r--commands/list.js4
-rw-r--r--commands/pause.js2
-rw-r--r--commands/ping.js2
-rw-r--r--commands/play.js2
-rw-r--r--commands/reshuffle.js3
-rw-r--r--commands/shutdown.js2
-rw-r--r--commands/skip.js2
-rw-r--r--commands/status.js2
14 files changed, 26 insertions, 26 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index 638fdcf..c096fef 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -11,6 +11,7 @@
"sourceType": "module"
},
"rules": {
- "semi": [2, "always"]
+ "semi": [2, "always"],
+ "space-before-function-paren": [2, "never"]
}
}
diff --git a/AudioBackend.js b/AudioBackend.js
index ed30afe..909882c 100644
--- a/AudioBackend.js
+++ b/AudioBackend.js
@@ -41,7 +41,7 @@ export let currentTrack;
export let playerState;
export let isAudioStatePaused;
-export async function voiceInit (bot) {
+export async function voiceInit(bot) {
bot.channels.fetch(config.voiceChannel).then(async channel => {
const connection = joinVoiceChannel({
channelId: channel.id,
@@ -49,7 +49,7 @@ export async function voiceInit (bot) {
adapterCreator: channel.guild.voiceAdapterCreator
});
- connection.on(VoiceConnectionStatus.Ready, async () => {
+ connection.on(VoiceConnectionStatus.Ready, async() => {
console.log('Ready to blast some beats!');
await shufflePlaylist(bot);
});
@@ -72,14 +72,14 @@ export async function voiceInit (bot) {
}).catch(e => { console.error(e); });
}
-function shuffleArray (array) {
+function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}
-export async function shufflePlaylist (bot) {
+export async function shufflePlaylist(bot) {
console.log('Shuffling beats...');
currentTrack = 0;
audioArray = files;
@@ -89,7 +89,7 @@ export async function shufflePlaylist (bot) {
return await playAudio(bot);
}
-export async function nextAudio (bot) {
+export async function nextAudio(bot) {
let totalTrack = files.length;
totalTrack--;
@@ -104,13 +104,13 @@ export async function nextAudio (bot) {
return await playAudio(bot);
}
-export async function inputAudio (bot, integer) {
+export async function inputAudio(bot, integer) {
const inputFiles = readdirSync('music');
audio = inputFiles[integer];
return await playAudio(bot);
}
-export async function playAudio (bot) {
+export async function playAudio(bot) {
const resource = createAudioResource('music/' + audio);
player.play(resource);
@@ -138,7 +138,7 @@ export async function playAudio (bot) {
return await statusChannel.send({ embeds: [statusEmbed] });
}
-export async function destroyAudio (interaction) {
+export async function destroyAudio(interaction) {
if (config.txtFile === true) {
fileData = 'Now Playing: Nothing';
writeFile('now-playing.txt', fileData, (err) => {
@@ -157,7 +157,7 @@ export async function destroyAudio (interaction) {
}
}
-export function audioState () {
+export function audioState() {
if (isAudioStatePaused === false) {
isAudioStatePaused = true;
playerState = 'Paused';
@@ -167,7 +167,7 @@ export function audioState () {
}
}
-export async function stopBot (bot, interaction) {
+export async function stopBot(bot, interaction) {
const statusEmbed = new MessageEmbed()
.setAuthor({ name: bot.user.username, iconURL: bot.user.avatarURL() })
.setDescription(`That's all folks! Powering down ${bot.user.username}...`)
diff --git a/bot.js b/bot.js
index 15dd663..cbad4a9 100644
--- a/bot.js
+++ b/bot.js
@@ -44,7 +44,7 @@ for (const file of commandFiles) {
bot.commands.set(command.data.name, command);
}
-bot.once('ready', async () => {
+bot.once('ready', async() => {
console.log('Bot is ready!');
console.log(`Logged in as ${bot.user.tag}!`);
console.log(`Running on Discord.JS ${version}`);
@@ -73,7 +73,7 @@ bot.once('ready', async () => {
if (!statusChannel) return console.error('The status channel does not exist! Skipping.');
await statusChannel.send({ embeds: [readyEmbed] });
- await voiceInit(bot);
+ return await voiceInit(bot);
});
bot.on('interactionCreate', async interaction => {
diff --git a/commands/about.js b/commands/about.js
index fa6d8a2..e87f1a6 100644
--- a/commands/about.js
+++ b/commands/about.js
@@ -29,7 +29,7 @@ export default {
data: new SlashCommandBuilder()
.setName('about')
.setDescription('Information about the bot'),
- async execute (interaction, bot) {
+ async execute(interaction, bot) {
const aboutEmbed = new MessageEmbed()
.setAuthor({ name: `About ${bot.user.username}`, iconURL: bot.user.avatarURL() })
.addField('Information', 'A Discord bot that plays local audio tracks.')
diff --git a/commands/join.js b/commands/join.js
index b309f97..02c50a4 100644
--- a/commands/join.js
+++ b/commands/join.js
@@ -28,7 +28,7 @@ export default {
.setName('join')
.setDescription('Joins voice chat')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
- async execute (interaction, bot) {
+ async execute(interaction, bot) {
await interaction.reply({ content: 'Joining voice channel', ephemeral: true });
return await voiceInit(bot);
}
diff --git a/commands/leave.js b/commands/leave.js
index b37ebdc..a066e38 100644
--- a/commands/leave.js
+++ b/commands/leave.js
@@ -28,7 +28,7 @@ export default {
.setName('leave')
.setDescription('Leaves the voice chat')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
- async execute (interaction) {
+ async execute(interaction) {
console.log('Leaving voice channel...');
await destroyAudio(interaction);
return await interaction.reply({ content: 'Leaving voice channel', ephemeral: true });
diff --git a/commands/list.js b/commands/list.js
index 9d7a7fd..8f2010b 100644
--- a/commands/list.js
+++ b/commands/list.js
@@ -28,11 +28,11 @@ export default {
data: new SlashCommandBuilder()
.setName('list')
.setDescription('Lists the available audio tracks'),
- async execute (interaction) {
+ async execute(interaction) {
// If someone figures out how to either split the list or make pages when the max character reaches, please do so and make a pull request.
const beats = readdirSync(musicFolder).join('\n');
- readdir(musicFolder, async (err, files) => {
+ readdir(musicFolder, async(err, files) => {
await interaction.reply(
`Listing ${files.length} audio tracks...\n\`\`\`\n${beats}\n\`\`\``
);
diff --git a/commands/pause.js b/commands/pause.js
index 629d423..8d42459 100644
--- a/commands/pause.js
+++ b/commands/pause.js
@@ -28,7 +28,7 @@ export default {
.setName('pause')
.setDescription('Pauses music')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
- async execute (interaction) {
+ async execute(interaction) {
if (isAudioStatePaused === false) {
audioState();
player.pause();
diff --git a/commands/ping.js b/commands/ping.js
index 574afc8..0c6b887 100644
--- a/commands/ping.js
+++ b/commands/ping.js
@@ -25,7 +25,7 @@ export default {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Pong!'),
- async execute (interaction, bot) {
+ async execute(interaction, bot) {
return await interaction.reply(`Pong! ${Math.round(bot.ws.ping)}ms`);
}
};
diff --git a/commands/play.js b/commands/play.js
index 324573d..4145f54 100644
--- a/commands/play.js
+++ b/commands/play.js
@@ -35,7 +35,7 @@ export default {
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
- async execute (interaction, bot) {
+ async execute(interaction, bot) {
integer = interaction.options.getInteger('int');
if (integer) {
if (integer < files.length) {
diff --git a/commands/reshuffle.js b/commands/reshuffle.js
index c0ad342..162a52e 100644
--- a/commands/reshuffle.js
+++ b/commands/reshuffle.js
@@ -28,8 +28,7 @@ export default {
.setName('reshuffle')
.setDescription('Reshuffles the playlist')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
- async execute (interaction, bot) {
- // Command not fully functional yet
+ async execute(interaction, bot) {
await interaction.reply({ content: 'Reshuffling the playlist...', ephemeral: true });
player.stop();
return await shufflePlaylist(bot);
diff --git a/commands/shutdown.js b/commands/shutdown.js
index 6e3c52b..196b289 100644
--- a/commands/shutdown.js
+++ b/commands/shutdown.js
@@ -28,7 +28,7 @@ export default {
.setName('shutdown')
.setDescription('Powers off the bot')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
- async execute (interaction, bot) {
+ async execute(interaction, bot) {
await interaction.reply({ content: 'Powering off...', ephemeral: true });
return await stopBot(bot, interaction);
}
diff --git a/commands/skip.js b/commands/skip.js
index 189aab7..b276790 100644
--- a/commands/skip.js
+++ b/commands/skip.js
@@ -28,7 +28,7 @@ export default {
.setName('skip')
.setDescription('Skips the audio track')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
- async execute (interaction, bot) {
+ async execute(interaction, bot) {
await interaction.reply({ content: `Skipping ${audio}`, ephemeral: true });
player.stop();
return await nextAudio(bot, interaction);
diff --git a/commands/status.js b/commands/status.js
index 9871157..c78e736 100644
--- a/commands/status.js
+++ b/commands/status.js
@@ -27,7 +27,7 @@ export default {
data: new SlashCommandBuilder()
.setName('status')
.setDescription('Checks what audio file is playing currently'),
- async execute (interaction, bot) {
+ async execute(interaction, bot) {
let audioID = currentTrack;
audioID++;