mirror of
https://github.com/Alee14/DLAP.git
synced 2025-01-22 10:52:03 -05:00
Deploy command changes; Filter bots on vote; Fixed status
This commit is contained in:
parent
ec7a6d2cd4
commit
891cf0ecda
5 changed files with 26 additions and 15 deletions
|
@ -36,9 +36,9 @@ export default {
|
||||||
{ name: t('aboutInfo'), value: t('aboutInfoValue') },
|
{ name: t('aboutInfo'), value: t('aboutInfoValue') },
|
||||||
{ name: t('aboutBotVersion'), value: `DLAP ${npmPackage.version}` },
|
{ name: t('aboutBotVersion'), value: `DLAP ${npmPackage.version}` },
|
||||||
{ name: t('aboutCreator'), value: 'Andrew Lee (alee)' }, // Do not remove this since I created this :)
|
{ 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('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' }
|
{ name: t('aboutLicense'), value: 'GNU General Public License v3.0' }
|
||||||
)
|
)
|
||||||
.setFooter({ text: '© Copyright 2020-2024 Andrew Lee' })
|
.setFooter({ text: '© Copyright 2020-2024 Andrew Lee' })
|
||||||
|
|
|
@ -40,10 +40,10 @@ export default {
|
||||||
|
|
||||||
// Get the members of the voice channel who have not voted yet
|
// Get the members of the voice channel who have not voted yet
|
||||||
const voiceChannel = interaction.member.voice.channel;
|
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
|
// 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) {
|
if (audioID >= files.length) {
|
||||||
audioName = t('playlistDone');
|
audioName = t('playlistDone');
|
||||||
|
@ -52,12 +52,10 @@ export default {
|
||||||
if (!metadataEmpty) {
|
if (!metadataEmpty) {
|
||||||
try {
|
try {
|
||||||
const { common } = await parseFile('music/' + audioName);
|
const { common } = await parseFile('music/' + audioName);
|
||||||
audioName = common.title;
|
audioName = common.title ? common.title : audioName.split('.').slice(0, -1).join('.');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error.message);
|
console.error(error.message);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
audioName = audioName.split('.').slice(0, -1).join('.');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ shutdown - Powers off the bot.
|
||||||
# Forking
|
# Forking
|
||||||
When forking the project, you can make your own version of DLAP or help contribute to the project (See the "Contributing" section).
|
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.
|
Be sure to replace that with your name.
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ export async function voteSkip(interaction, bot) {
|
||||||
if (interaction.options.getSubcommand() === 'vote') {
|
if (interaction.options.getSubcommand() === 'vote') {
|
||||||
// Get the members of the voice channel who have not voted yet
|
// Get the members of the voice channel who have not voted yet
|
||||||
const voiceChannel = interaction.member.voice.channel;
|
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
|
// Calculate the number of votes required to skip the audio track
|
||||||
const votesRequired = Math.ceil(members.size / 2);
|
const votesRequired = Math.ceil(members.size / 2);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import fs, { readFileSync } from 'node:fs';
|
import fs, { readFileSync } from 'node:fs';
|
||||||
import { REST } from '@discordjs/rest';
|
import { REST, Routes } from 'discord.js';
|
||||||
import { Routes } from 'discord-api-types/v10';
|
|
||||||
// import config from './config.json' assert {type: 'json'}
|
// import config from './config.json' assert {type: 'json'}
|
||||||
const { clientID, token } = JSON.parse(readFileSync('./config.json'));
|
const { clientID, token } = JSON.parse(readFileSync('./config.json'));
|
||||||
|
|
||||||
|
@ -12,8 +11,22 @@ for (const file of commandFiles) {
|
||||||
commands.push(command.data.toJSON());
|
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 })
|
// and deploy your commands!
|
||||||
.then(() => console.log('Successfully registered application commands.'))
|
(async() => {
|
||||||
.catch(console.error);
|
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);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
Loading…
Reference in a new issue