mirror of
https://github.com/Alee14/DLAP.git
synced 2025-01-22 10:52:03 -05:00
Added another eslint rule
This commit is contained in:
parent
e5020f2c62
commit
626cef8516
14 changed files with 26 additions and 26 deletions
|
@ -11,6 +11,7 @@
|
|||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
"semi": [2, "always"]
|
||||
"semi": [2, "always"],
|
||||
"space-before-function-paren": [2, "never"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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}...`)
|
||||
|
|
4
bot.js
4
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 => {
|
||||
|
|
|
@ -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.')
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 });
|
||||
|
|
|
@ -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\`\`\``
|
||||
);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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`);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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++;
|
||||
|
||||
|
|
Loading…
Reference in a new issue