diff options
| -rw-r--r-- | Commands/about.js | 4 | ||||
| -rw-r--r-- | Commands/status.js | 8 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | Utilities/Voting.js | 2 | ||||
| -rw-r--r-- | deploy-command.js | 25 |
5 files changed, 26 insertions, 15 deletions
diff --git a/Commands/about.js b/Commands/about.js index d8afa52..8e1d31d 100644 --- a/Commands/about.js +++ b/Commands/about.js @@ -36,9 +36,9 @@ export default { { name: t('aboutInfo'), value: t('aboutInfoValue') }, { name: t('aboutBotVersion'), value: `DLAP ${npmPackage.version}` }, { name: t('aboutCreator'), value: 'Andrew Lee (alee)' }, // Do not remove this since I created this :) - // { name: t('aboutContributors'), value: '[your name] (username)' }, + { name: t('aboutContributors'), value: 'Victor Moraes (Vicktor#7232) (Improving README)' }, // { name: t('aboutForked'), value: '[your name] (username)' }, - { name: t('aboutFrameworks'), value: `Discord.JS ${version} + Voice` }, + { name: t('aboutFrameworks'), value: `Discord.JS ${version}\nmusic-metadata` }, { name: t('aboutLicense'), value: 'GNU General Public License v3.0' } ) .setFooter({ text: '© Copyright 2020-2024 Andrew Lee' }) diff --git a/Commands/status.js b/Commands/status.js index d762187..fcc6c08 100644 --- a/Commands/status.js +++ b/Commands/status.js @@ -40,10 +40,10 @@ export default { // Get the members of the voice channel who have not voted yet const voiceChannel = interaction.member.voice.channel; - const members = voiceChannel.members.filter(m => !votes.has(m.id)); + const members = voiceChannel.members.filter(m => !votes.has(m.id) && !m.user.bot); // Calculate the number of votes required to skip the audio track - const votesRequired = Math.ceil((members.size - votes.size) / 2); + const votesRequired = Math.ceil(members.size / 2); if (audioID >= files.length) { audioName = t('playlistDone'); @@ -52,12 +52,10 @@ export default { if (!metadataEmpty) { try { const { common } = await parseFile('music/' + audioName); - audioName = common.title; + audioName = common.title ? common.title : audioName.split('.').slice(0, -1).join('.'); } catch (error) { console.error(error.message); } - } else { - audioName = audioName.split('.').slice(0, -1).join('.'); } } @@ -141,7 +141,7 @@ shutdown - Powers off the bot. # Forking When forking the project, you can make your own version of DLAP or help contribute to the project (See the "Contributing" section). -You need to edit `/commands/about.js` to uncomment the `{ name: 'Forked by', value: '[your name] (discord#0000)' }` section. +You need to edit `/commands/about.js` to uncomment the `{ name: 'Forked by', value: '[your name] (username)' }` section. Be sure to replace that with your name. diff --git a/Utilities/Voting.js b/Utilities/Voting.js index 452dc55..fe38ab0 100644 --- a/Utilities/Voting.js +++ b/Utilities/Voting.js @@ -57,7 +57,7 @@ export async function voteSkip(interaction, bot) { if (interaction.options.getSubcommand() === 'vote') { // Get the members of the voice channel who have not voted yet const voiceChannel = interaction.member.voice.channel; - const members = voiceChannel.members.filter(m => !votes.has(m.id)); + const members = voiceChannel.members.filter(m => !votes.has(m.id) && !m.user.bot); // Calculate the number of votes required to skip the audio track const votesRequired = Math.ceil(members.size / 2); diff --git a/deploy-command.js b/deploy-command.js index fd9de7a..0b57507 100644 --- a/deploy-command.js +++ b/deploy-command.js @@ -1,6 +1,5 @@ import fs, { readFileSync } from 'node:fs'; -import { REST } from '@discordjs/rest'; -import { Routes } from 'discord-api-types/v10'; +import { REST, Routes } from 'discord.js'; // import config from './config.json' assert {type: 'json'} const { clientID, token } = JSON.parse(readFileSync('./config.json')); @@ -12,8 +11,22 @@ for (const file of commandFiles) { commands.push(command.data.toJSON()); } -const rest = new REST({ version: '10' }).setToken(token); +const rest = new REST().setToken(token); -rest.put(Routes.applicationCommands(clientID), { body: commands }) - .then(() => console.log('Successfully registered application commands.')) - .catch(console.error); +// and deploy your commands! +(async() => { + try { + console.log(`Started refreshing ${commands.length} application (/) commands.`); + + // The put method is used to fully refresh all commands in the guild with the current set + const data = await rest.put( + Routes.applicationCommands(clientID), + { body: commands } + ); + + console.log(`Successfully reloaded ${data.length} application (/) commands.`); + } catch (error) { + // And of course, make sure you catch and log any errors! + console.error(error); + } +})(); |
