feat!: Updated configuration and moved config location

This commit is contained in:
Marius Begby committed 2023-07-18 13:11:15 +02:00
1 parent 2d0df79dac
commit dd4b56ae67
40 files changed
+468 -482

No files matched your search

+8 -10
View File
@@ -1,7 +1,5 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons, botInfo } = require(path.resolve('./config.json'));
const { embedOptions, botOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
@@ -13,22 +11,22 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`${embedIcons.rule} **List of commands**\n` +
`${embedOptions.icons.rule} **List of commands**\n` +
'- **`/play` `query`** - Add a track or playlist to the queue by url or search.\n' +
'- **`/pause`** - Pause or resume the current track.\n' +
'- **`/queue` `[page]`** - Show the list of tracks added to the queue.\n' +
'- **`/nowplaying`** - Show information about the track currently playing.\n' +
`- **\`/seek\` \`duration\`** - ${embedIcons.new} Seek to a specified duration in the current track.\n` +
`- **\`/loop\` \`mode\`** - ${embedIcons.beta} Toggle looping a track, the whole queue or autoplay.\n` +
`- **\`/seek\` \`duration\`** - ${embedOptions.icons.new} Seek to a specified duration in the current track.\n` +
`- **\`/loop\` \`mode\`** - ${embedOptions.icons.beta} Toggle looping a track, the whole queue or autoplay.\n` +
'- **`/filters`** - Toggle various audio filters during playback.\n' +
'- **`/volume` `[percentage]`** - Show or set the playback volume for tracks.\n' +
'- **`/skip` `[tracknumber]`** - Skip to next or specified track.\n' +
'- **`/remove` `tracknumber`** - Remove specified track from the queue.\n' +
'- **`/leave`** - Clear the queue and remove the bot from voice channel.\n\n' +
`${embedIcons.support} **Support server**\nJoin the support server for help or suggestions: \n**${botInfo.supportServerInviteUrl}**\n\n` +
`${embedIcons.bot} **Enjoying ${botInfo.name}?**\nAdd me to another server: \n**[Click me!](${botInfo.botInviteUrl})**`
`${embedOptions.icons.support} **Support server**\nJoin the support server for help or suggestions: \n**${botOptions.serverInviteUrl}**\n\n` +
`${embedOptions.icons.bot} **Enjoying ${botOptions.name}?**\nAdd me to another server: \n**[Click me!](${botOptions.botInviteUrl})**`
)
.setColor(embedColors.colorInfo)
.setColor(embedOptions.colors.info)
]
});
}
+27 -19
View File
@@ -1,14 +1,13 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { useQueue } = require('discord-player');
const { embedOptions, ffmpegFilterOptions } = require('../../config');
const {
SlashCommandBuilder,
EmbedBuilder,
ActionRowBuilder,
StringSelectMenuBuilder,
StringSelectMenuOptionBuilder,
ActionRowBuilder,
ButtonBuilder
} = require('discord.js');
const { embedColors, embedIcons, filterList, filterThreadAmount } = require(path.resolve('./config.json'));
const { useQueue } = require('discord-player');
module.exports = {
data: new SlashCommandBuilder()
@@ -21,9 +20,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
`**${embedOptions.icons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -35,16 +34,16 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere are no tracks in the queue. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere are no tracks in the queue. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
let filterOptions = [];
filterList.forEach((filter) => {
ffmpegFilterOptions.availableFilters.forEach((filter) => {
let isEnabled = false;
if (queue.filters.ffmpeg.filters.includes(filter.value)) {
@@ -75,16 +74,16 @@ module.exports = {
.setCustomId('disable-filters')
.setLabel('Disable all filters')
.setStyle('Secondary')
.setEmoji(embedIcons.disable)
.setEmoji(embedOptions.icons.disable)
);
const response = await interaction.editReply({
embeds: [
new EmbedBuilder()
.setDescription(
`**Toggle filters** ${embedIcons.beta}\nEnable or disable audio filters for playback from the menu.`
`**Toggle filters** ${embedOptions.icons.beta}\nEnable or disable audio filters for playback from the menu.`
)
.setColor(embedColors.colorInfo)
.setColor(embedOptions.colors.info)
],
components: [filterActionRow, disableFiltersActionRow]
});
@@ -100,7 +99,7 @@ module.exports = {
queue.filters.ffmpeg.setInputArgs([
'-threads',
filterThreadAmount,
ffmpegFilterOptions.threadAmount,
'-reconnect',
'1',
'-reconnect_streamed',
@@ -124,9 +123,9 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.success} Disabled filters**\nAll audio filters have been disabled.`
`**${embedOptions.icons.success} Disabled filters**\nAll audio filters have been disabled.`
)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
],
components: []
});
@@ -143,11 +142,20 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.success} Filters toggled**\nNow using these filters:\n${confirmation.values
.map((enabled) => `\`${filterList.find((filter) => enabled == filter.value).label}\``)
`**${
embedOptions.icons.success
} Filters toggled**\nNow using these filters:\n${confirmation.values
.map(
(enabled) =>
`\`${
ffmpegFilterOptions.availableFilters.find(
(filter) => enabled == filter.value
).label
}\``
)
.join(', ')}.`
)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
],
components: []
});
+8 -10
View File
@@ -1,8 +1,6 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { embedOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = {
data: new SlashCommandBuilder()
@@ -17,9 +15,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
`**${embedOptions.icons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -31,9 +29,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\n_Hmm.._ It seems I am not in a voice channel!`
`**${embedOptions.icons.warning} Oops!**\n_Hmm.._ It seems I am not in a voice channel!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -49,9 +47,9 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.success} Leaving channel**\nCleared the track queue and left voice channel.\n\nTo play more music, use the **\`/play\`** command!`
`**${embedOptions.icons.success} Leaving channel**\nCleared the track queue and left voice channel.\n\nTo play more music, use the **\`/play\`** command!`
)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
]
});
}
+20 -20
View File
@@ -1,8 +1,6 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { embedOptions, botOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons, botInfo } = require(path.resolve('./config.json'));
module.exports = {
data: new SlashCommandBuilder()
@@ -27,9 +25,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
`**${embedOptions.icons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -41,9 +39,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -66,10 +64,10 @@ module.exports = {
new EmbedBuilder()
.setDescription(
`**${
currentMode === 3 ? embedIcons.autoplay : embedIcons.loop
currentMode === 3 ? embedOptions.icons.autoplay : embedOptions.icons.loop
} Current loop mode**\nThe looping mode is currently set to \`${currentModeUserString}\`.`
)
.setColor(embedColors.colorInfo)
.setColor(embedOptions.colors.info)
]
});
}
@@ -78,8 +76,10 @@ module.exports = {
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setDescription(`**${embedIcons.warning} Oops!**\nLoop mode is already \`${modeUserString}\`.`)
.setColor(embedColors.colorWarning)
.setDescription(
`**${embedOptions.icons.warning} Oops!**\nLoop mode is already \`${modeUserString}\`.`
)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -91,9 +91,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.error} Uh-oh... Failed to change loop mode!**\nI tried to change the loop mode to \`${modeUserString}\`, but something went wrong.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect or the issue persists, please submit a bug report in the **[support server](${botInfo.supportServerInviteUrl})**._`
`**${embedOptions.icons.error} Uh-oh... Failed to change loop mode!**\nI tried to change the loop mode to \`${modeUserString}\`, but something went wrong.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect or the issue persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
)
.setColor(embedColors.colorError)
.setColor(embedOptions.colors.error)
]
});
}
@@ -107,9 +107,9 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.success} Loop mode disabled**\nChanging loop mode from \`${currentModeUserString}\` to \`${modeUserString}\`.\n\nThe ${currentModeUserString} will no longer play on repeat!`
`**${embedOptions.icons.success} Loop mode disabled**\nChanging loop mode from \`${currentModeUserString}\` to \`${modeUserString}\`.\n\nThe ${currentModeUserString} will no longer play on repeat!`
)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
]
});
}
@@ -123,9 +123,9 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.autoplaying} Loop mode changed**\nChanging loop mode from \`${currentModeUserString}\` to \`${modeUserString}\`.\n\nWhen the queue is empty, similar tracks will start playing!`
`**${embedOptions.icons.autoplaying} Loop mode changed**\nChanging loop mode from \`${currentModeUserString}\` to \`${modeUserString}\`.\n\nWhen the queue is empty, similar tracks will start playing!`
)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
]
});
}
@@ -138,9 +138,9 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.looping} Loop mode changed**\nChanging loop mode from \`${currentModeUserString}\` to \`${modeUserString}\`.\n\nThe ${modeUserString} will now play on repeat!`
`**${embedOptions.icons.looping} Loop mode changed**\nChanging loop mode from \`${currentModeUserString}\` to \`${modeUserString}\`.\n\nThe ${modeUserString} will now play on repeat!`
)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
]
});
}
+31 -31
View File
@@ -1,8 +1,6 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { embedOptions, playerOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');
const { useQueue } = require('discord-player');
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');
const { embedColors, embedIcons, progressBarOptions } = require(path.resolve('./config.json'));
module.exports = {
data: new SlashCommandBuilder()
@@ -15,9 +13,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
`**${embedOptions.icons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -29,9 +27,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -41,9 +39,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -57,11 +55,11 @@ module.exports = {
]);
const sourceIcons = new Map([
['youtube', embedIcons.sourceYouTube],
['soundcloud', embedIcons.sourceSoundCloud],
['spotify', embedIcons.sourceSpotify],
['apple_music', embedIcons.sourceAppleMusic],
['arbitrary', embedIcons.sourceArbitrary]
['youtube', embedOptions.icons.sourceYouTube],
['soundcloud', embedOptions.icons.sourceSoundCloud],
['spotify', embedOptions.icons.sourceSpotify],
['apple_music', embedOptions.icons.sourceAppleMusic],
['arbitrary', embedOptions.icons.sourceArbitrary]
]);
const currentTrack = queue.currentTrack;
@@ -88,11 +86,11 @@ module.exports = {
const timestamp = queue.node.getTimestamp();
let bar = `**\`${timestamp.current.label}\`** ${queue.node.createProgressBar({
queue: false,
length: progressBarOptions.length ?? 12,
timecodes: progressBarOptions.timecodes ?? false,
indicator: progressBarOptions.indicator ?? '🔘',
leftChar: progressBarOptions.leftChar ?? '▬',
rightChar: progressBarOptions.rightChar ?? '▬'
length: playerOptions.progressBar.length ?? 12,
timecodes: playerOptions.progressBar.timecodes ?? false,
indicator: playerOptions.progressBar.indicator ?? '🔘',
leftChar: playerOptions.progressBar.leftChar ?? '▬',
rightChar: playerOptions.progressBar.rightChar ?? '▬'
})} **\`${timestamp.total.label}\`**`;
if (currentTrack.raw.duration === 0 || currentTrack.duration === '0:00') {
@@ -104,7 +102,7 @@ module.exports = {
.setCustomId('nowplaying-skip')
.setLabel('Skip track')
.setStyle('Secondary')
.setEmoji(embedIcons.nextTrack)
.setEmoji(embedOptions.icons.nextTrack)
);
const loopModesFormatted = new Map([
@@ -126,7 +124,7 @@ module.exports = {
.setDescription(
(queue.node.isPaused()
? '**Currently Paused**\n'
: `**${embedIcons.audioPlaying} Now Playing**\n`) +
: `**${embedOptions.icons.audioPlaying} Now Playing**\n`) +
`**[${currentTrack.title}](${currentTrack.url})**` +
`\nRequested by: <@${currentTrack.requestedBy.id}>` +
`\n ${bar}\n\n` +
@@ -134,7 +132,7 @@ module.exports = {
queue.repeatMode === 0
? ''
: `**${
queue.repeatMode === 3 ? embedIcons.autoplay : embedIcons.loop
queue.repeatMode === 3 ? embedOptions.icons.autoplay : embedOptions.icons.loop
} Looping**\nLoop mode is set to ${loopModeUserString}. You can change it with **\`/loop\`**.`
}`
)
@@ -159,7 +157,7 @@ module.exports = {
text: queueLength ? `${queueLength} other tracks in the queue...` : ' '
})
.setThumbnail(queue.currentTrack.thumbnail)
.setColor(embedColors.colorInfo)
.setColor(embedOptions.colors.info)
],
components: [nowPlayingActionRow]
});
@@ -179,9 +177,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
],
components: []
});
@@ -192,9 +190,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThis track has already been skipped or is no longer playing.`
`**${embedOptions.icons.warning} Oops!**\nThis track has already been skipped or is no longer playing.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
],
components: []
});
@@ -217,17 +215,19 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.skipped} Skipped track**\n**${durationFormat} [${skippedTrack.title}](${skippedTrack.url})**` +
`**${embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${skippedTrack.title}](${skippedTrack.url})**` +
`${
queue.repeatMode === 0
? ''
: `\n\n**${
queue.repeatMode === 3 ? embedIcons.autoplaying : embedIcons.looping
queue.repeatMode === 3
? embedOptions.icons.autoplaying
: embedOptions.icons.looping
} Looping**\nLoop mode is set to ${repeatModeUserString}. You can change it with **\`/loop\`**.`
}`
)
.setThumbnail(skippedTrack.thumbnail)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
],
components: []
});
+10 -12
View File
@@ -1,8 +1,6 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { embedOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = {
data: new SlashCommandBuilder()
@@ -15,9 +13,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
`**${embedOptions.icons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -29,9 +27,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -41,9 +39,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -64,12 +62,12 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.pauseResumed} ${
`**${embedOptions.icons.pauseResumed} ${
queue.node.isPaused() ? 'Paused Track' : 'Resumed track'
}**\n**${durationFormat} [${queue.currentTrack.title}](${queue.currentTrack.url})**`
)
.setThumbnail(queue.currentTrack.thumbnail)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
]
});
}
+24 -26
View File
@@ -1,8 +1,6 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { embedOptions, playerOptions, botOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useMainPlayer, useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons, playerOptions, botInfo } = require(path.resolve('./config.json'));
module.exports = {
data: new SlashCommandBuilder()
@@ -16,9 +14,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
`**${embedOptions.icons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -35,9 +33,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} No track found**\nNo results found for \`${query}\`.\n\nIf you specified a URL, please make sure it is valid and public.`
`**${embedOptions.icons.warning} No track found**\nNo results found for \`${query}\`.\n\nIf you specified a URL, please make sure it is valid and public.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -51,9 +49,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Unsupported audio source**\nYouTube live streams are currently not supported. This is due to issues with extracting audio from the livestream.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botInfo.supportServerInviteUrl})**._`
`**${embedOptions.icons.warning} Unsupported audio source**\nYouTube live streams are currently not supported. This is due to issues with extracting audio from the livestream.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -81,9 +79,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Cannot retrieve audio for track**\nThis audio source is age restricted and requires login to access. Because of this I cannot retrieve the audio for the track.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botInfo.supportServerInviteUrl})**._`
`**${embedOptions.icons.warning} Cannot retrieve audio for track**\nThis audio source is age restricted and requires login to access. Because of this I cannot retrieve the audio for the track.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -98,9 +96,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.error} Uh-oh... Failed to add track!**\nAfter finding a result, I was unable to retrieve audio for the track.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botInfo.supportServerInviteUrl})**._`
`**${embedOptions.icons.error} Uh-oh... Failed to add track!**\nAfter finding a result, I was unable to retrieve audio for the track.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
)
.setColor(embedColors.colorError)
.setColor(embedOptions.colors.error)
]
});
}
@@ -110,9 +108,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.error} Uh-oh... Failed to add track!**\nSomething unexpected happened and the operation was cancelled.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botInfo.supportServerInviteUrl})**._`
`**${embedOptions.icons.error} Uh-oh... Failed to add track!**\nSomething unexpected happened and the operation was cancelled.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
)
.setColor(embedColors.colorError)
.setColor(embedOptions.colors.error)
]
});
}
@@ -125,9 +123,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.error} Uh-oh... Failed to add track!**\nThere was an issue adding this track to the queue.\n\nYou can try to perform the command again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botInfo.supportServerInviteUrl})**._`
`**${embedOptions.icons.error} Uh-oh... Failed to add track!**\nThere was an issue adding this track to the queue.\n\nYou can try to perform the command again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
)
.setColor(embedColors.colorError)
.setColor(embedOptions.colors.error)
]
});
}
@@ -148,14 +146,14 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.success} Added playlist to queue**\n**${durationFormat} [${track.title}](${
track.url
})**\n\nAnd **${
`**${embedOptions.icons.success} Added playlist to queue**\n**${durationFormat} [${
track.title
}](${track.url})**\n\nAnd **${
searchResult.tracks.length - 1
}** more tracks... **\`/queue\`** to view all.`
)
.setThumbnail(track.thumbnail)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
]
});
}
@@ -170,10 +168,10 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.audioStartedPlaying} Started playing**\n**${durationFormat} [${track.title}](${track.url})**`
`**${embedOptions.icons.audioStartedPlaying} Started playing**\n**${durationFormat} [${track.title}](${track.url})**`
)
.setThumbnail(track.thumbnail)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
]
});
}
@@ -186,10 +184,10 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`${embedIcons.success} **Added to queue**\n**${durationFormat} [${track.title}](${track.url})**`
`${embedOptions.icons.success} **Added to queue**\n**${durationFormat} [${track.title}](${track.url})**`
)
.setThumbnail(track.thumbnail)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
]
});
}
+21 -23
View File
@@ -1,8 +1,6 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { embedOptions, playerOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons, progressBarOptions } = require(path.resolve('./config.json'));
module.exports = {
data: new SlashCommandBuilder()
@@ -16,9 +14,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
`**${embedOptions.icons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -33,11 +31,11 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nPage \`${
`**${embedOptions.icons.warning} Oops!**\nPage \`${
pageIndex + 1
}\` is not a valid page number.\n\nThe queue is currently empty, first add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -50,8 +48,8 @@ module.exports = {
name: interaction.guild.name,
iconURL: interaction.guild.iconURL()
})
.setDescription(`**${embedIcons.queue} Tracks in queue**\n${queueString}`)
.setColor(embedColors.colorInfo)
.setDescription(`**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`)
.setColor(embedOptions.colors.info)
.setFooter({
text: 'Page 1 of 1'
})
@@ -66,11 +64,11 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nPage \`${
`**${embedOptions.icons.warning} Oops!**\nPage \`${
pageIndex + 1
}\` is not a valid page number.\n\nThere are only a total of \`${totalPages}\` pages in the queue.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -104,7 +102,7 @@ module.exports = {
queue.repeatMode === 0
? ''
: `**${
queue.repeatMode === 3 ? embedIcons.autoplay : embedIcons.loop
queue.repeatMode === 3 ? embedOptions.icons.autoplay : embedOptions.icons.loop
} Looping**\nLoop mode is set to ${loopModeUserString}. You can change it with **\`/loop\`**.\n\n`
}`;
@@ -117,23 +115,23 @@ module.exports = {
iconURL: interaction.guild.iconURL()
})
.setDescription(
`${repeatModeString}` + `**${embedIcons.queue} Tracks in queue**\n${queueString}`
`${repeatModeString}` + `**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`
)
.setFooter({
text: `Page ${pageIndex + 1} of ${totalPages}`
})
.setColor(embedColors.colorInfo)
.setColor(embedOptions.colors.info)
]
});
} else {
const timestamp = queue.node.getTimestamp();
let bar = `**\`${timestamp.current.label}\`** ${queue.node.createProgressBar({
queue: false,
length: progressBarOptions.length ?? 12,
timecodes: progressBarOptions.timecodes ?? false,
indicator: progressBarOptions.indicator ?? '🔘',
leftChar: progressBarOptions.leftChar ?? '▬',
rightChar: progressBarOptions.rightChar ?? '▬'
length: playerOptions.progressBar.length ?? 12,
timecodes: playerOptions.progressBar.timecodes ?? false,
indicator: playerOptions.progressBar.indicator ?? '🔘',
leftChar: playerOptions.progressBar.leftChar ?? '▬',
rightChar: playerOptions.progressBar.rightChar ?? '▬'
})} **\`${timestamp.total.label}\`**`;
if (currentTrack.raw.duration === 0 || currentTrack.duration === '0:00') {
@@ -148,18 +146,18 @@ module.exports = {
iconURL: interaction.guild.iconURL()
})
.setDescription(
`**${embedIcons.audioPlaying} Now playing**\n` +
`**${embedOptions.icons.audioPlaying} Now playing**\n` +
(currentTrack ? `**[${currentTrack.title}](${currentTrack.url})**` : 'None') +
`\nRequested by: <@${currentTrack.requestedBy.id}>` +
`\n ${bar}\n\n` +
`${repeatModeString}` +
`**${embedIcons.queue} Tracks in queue**\n${queueString}`
`**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`
)
.setThumbnail(queue.currentTrack.thumbnail)
.setFooter({
text: `Page ${pageIndex + 1} of ${totalPages}`
})
.setColor(embedColors.colorInfo)
.setColor(embedOptions.colors.info)
]
});
}
+10 -12
View File
@@ -1,8 +1,6 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { embedOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = {
data: new SlashCommandBuilder()
@@ -22,9 +20,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
`**${embedOptions.icons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -36,9 +34,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -50,9 +48,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nTrack \`${removeTrackNumber}\` is not a valid track number. There are a total of\`${queue.tracks.data.length}\` tracks in the queue.\n\nView tracks added to the queue with **\`/queue\`**.`
`**${embedOptions.icons.warning} Oops!**\nTrack \`${removeTrackNumber}\` is not a valid track number. There are a total of\`${queue.tracks.data.length}\` tracks in the queue.\n\nView tracks added to the queue with **\`/queue\`**.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -70,10 +68,10 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.success} Removed track**\n**${durationFormat} [${removedTrack.title}](${removedTrack.url})**`
`**${embedOptions.icons.success} Removed track**\n**${durationFormat} [${removedTrack.title}](${removedTrack.url})**`
)
.setThumbnail(removedTrack.thumbnail)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
]
});
}
+18 -20
View File
@@ -1,8 +1,6 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { embedOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = {
data: new SlashCommandBuilder()
@@ -21,9 +19,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
`**${embedOptions.icons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -35,9 +33,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -47,9 +45,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -73,12 +71,12 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou entered an invalid duration format, \`${durationString}\`.\n\nPlease use the format \`HH:mm:ss\`, \`mm:ss\` or \`ss\`, where \`HH\` is hours, \`mm\` is minutes and \`ss\` is seconds.\n\n**Examples:**\n` +
`**${embedOptions.icons.warning} Oops!**\nYou entered an invalid duration format, \`${durationString}\`.\n\nPlease use the format \`HH:mm:ss\`, \`mm:ss\` or \`ss\`, where \`HH\` is hours, \`mm\` is minutes and \`ss\` is seconds.\n\n**Examples:**\n` +
'- `/seek` **`1:24:12`** - Seek to 1 hour, 24 minutes and 12 seconds.\n' +
'- `/seek` **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
'- `/seek` **`42`** - Seek to 42 seconds.'
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -98,12 +96,12 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou entered an invalid duration format, \`${durationString}\`.\n\nPlease use the format \`HH:mm:ss\`, \`mm:ss\` or \`ss\`, where \`HH\` is hours, \`mm\` is minutes and \`ss\` is seconds.\n\n**Examples:**\n` +
`**${embedOptions.icons.warning} Oops!**\nYou entered an invalid duration format, \`${durationString}\`.\n\nPlease use the format \`HH:mm:ss\`, \`mm:ss\` or \`ss\`, where \`HH\` is hours, \`mm\` is minutes and \`ss\` is seconds.\n\n**Examples:**\n` +
'- `/seek` **`1:24:12`** - Seek to 1 hour, 24 minutes and 12 seconds.\n' +
'- `/seek` **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
'- `/seek` **`42`** - Seek to 42 seconds.'
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -118,12 +116,12 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou entered an invalid duration format, \`${durationString}\`.\n\nPlease use the format \`HH:mm:ss\`, \`mm:ss\` or \`ss\`, where \`HH\` is hours, \`mm\` is minutes and \`ss\` is seconds.\n\n**Examples:**\n` +
`**${embedOptions.icons.warning} Oops!**\nYou entered an invalid duration format, \`${durationString}\`.\n\nPlease use the format \`HH:mm:ss\`, \`mm:ss\` or \`ss\`, where \`HH\` is hours, \`mm\` is minutes and \`ss\` is seconds.\n\n**Examples:**\n` +
'- `/seek` **`1:24:12`** - Seek to 1 hour, 24 minutes and 12 seconds.\n' +
'- `/seek` **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
'- `/seek` **`42`** - Seek to 42 seconds.'
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -136,9 +134,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou entered **\`${durationString}\`**, which is a duration that is longer than the duration for the current track.\n\nPlease try a duration that is less than the duration of the track (**\`${queue.currentTrack.duration}\`**).`
`**${embedOptions.icons.warning} Oops!**\nYou entered **\`${durationString}\`**, which is a duration that is longer than the duration for the current track.\n\nPlease try a duration that is less than the duration of the track (**\`${queue.currentTrack.duration}\`**).`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -152,10 +150,10 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.success} Seeking to duration**\nSeeking to **\`${durationString}\`** in current track.`
`**${embedOptions.icons.success} Seeking to duration**\nSeeking to **\`${durationString}\`** in current track.`
)
.setThumbnail(queue.currentTrack.thumbnail)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
]
});
}
+17 -17
View File
@@ -1,8 +1,6 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { embedOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = {
data: new SlashCommandBuilder()
@@ -18,9 +16,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
`**${embedOptions.icons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -32,9 +30,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -47,9 +45,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere are only \`${queue.tracks.data.length}\` tracks in the queue. You cannot skip to track \`${skipToTrack}\`.\n\nView tracks added to the queue with **\`/queue\`**.`
`**${embedOptions.icons.warning} Oops!**\nThere are only \`${queue.tracks.data.length}\` tracks in the queue. You cannot skip to track \`${skipToTrack}\`.\n\nView tracks added to the queue with **\`/queue\`**.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
} else {
@@ -68,10 +66,10 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.skipped} Skipped track**\n**${durationFormat} [${skippedTrack.title}](${skippedTrack.url})**`
`**${embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${skippedTrack.title}](${skippedTrack.url})**`
)
.setThumbnail(skippedTrack.thumbnail)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
]
});
}
@@ -81,9 +79,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -112,17 +110,19 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.skipped} Skipped track**\n**${durationFormat} [${skippedTrack.title}](${skippedTrack.url})**` +
`**${embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${skippedTrack.title}](${skippedTrack.url})**` +
`${
queue.repeatMode === 0
? ''
: `\n\n**${
queue.repeatMode === 3 ? embedIcons.autoplaying : embedIcons.looping
queue.repeatMode === 3
? embedOptions.icons.autoplaying
: embedOptions.icons.looping
} Looping**\nLoop mode is set to ${loopModeUserString}. You can change it with **\`/loop\`**.`
}`
)
.setThumbnail(skippedTrack.thumbnail)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
]
});
}
+14 -16
View File
@@ -1,8 +1,6 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { embedOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = {
data: new SlashCommandBuilder()
@@ -22,9 +20,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
`**${embedOptions.icons.warning} Oops!**\nYou need to be in a voice channel to use this command.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -36,9 +34,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
`**${embedOptions.icons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -53,10 +51,10 @@ module.exports = {
new EmbedBuilder()
.setDescription(
`**${
currentVolume === 0 ? embedIcons.volumeIsMuted : embedIcons.volume
currentVolume === 0 ? embedOptions.icons.volumeIsMuted : embedOptions.icons.volume
} Playback volume**\nThe playback volume is currently set to \`${currentVolume}%\`.`
)
.setColor(embedColors.colorInfo)
.setColor(embedOptions.colors.info)
]
});
} else if (volume > 100 || volume < 0) {
@@ -64,9 +62,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nYou cannot set the volume to \`${volume}\`, please pick a value betwen \`1\`% and \`100\`%.`
`**${embedOptions.icons.warning} Oops!**\nYou cannot set the volume to \`${volume}\`, please pick a value betwen \`1\`% and \`100\`%.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
} else {
@@ -81,9 +79,9 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.volumeMuted} Audio muted**\nPlayback audio has been muted, because volume was set to \`${volume}%\`.`
`**${embedOptions.icons.volumeMuted} Audio muted**\nPlayback audio has been muted, because volume was set to \`${volume}%\`.`
)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
]
});
}
@@ -96,9 +94,9 @@ module.exports = {
iconURL: interaction.user.avatarURL()
})
.setDescription(
`**${embedIcons.volumeChanged} Volume changed**\nPlayback volume has been changed to \`${volume}%\`.`
`**${embedOptions.icons.volumeChanged} Volume changed**\nPlayback volume has been changed to \`${volume}%\`.`
)
.setColor(embedColors.colorSuccess)
.setColor(embedOptions.colors.success)
]
});
}
+7 -9
View File
@@ -1,7 +1,5 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons, systemServerGuildIds } = require(path.resolve('./config.json'));
const { embedOptions, systemOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
module.exports = {
isSystemCommand: true,
@@ -10,14 +8,14 @@ module.exports = {
.setDescription('Show list of guilds where bot is added.')
.setDMPermission(false),
execute: async ({ interaction, client }) => {
if (!systemServerGuildIds.includes(interaction.guildId)) {
if (!systemOptions.systemGuildIds.includes(interaction.guildId)) {
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nNo permission to execute this command.\n\nThe command \`${interaction.commandName}\` cannot be executed in this server.`
`**${embedOptions.icons.warning} Oops!**\nNo permission to execute this command.\n\nThe command \`${interaction.commandName}\` cannot be executed in this server.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -37,7 +35,7 @@ module.exports = {
const totalMemberCount = client.guilds.cache.reduce((a, b) => a + b.memberCount, 0);
let embedDescription =
`**${embedIcons.bot} ${
`**${embedOptions.icons.bot} ${
client.guilds.cache.size < 50 ? `Top ${client.guilds.cache.size} guilds` : 'Top 50 guilds'
} by member count (${client.guilds.cache.size} total)**\n${guildsList}` +
`\n\n**Total members:** \`${totalMemberCount}\``;
@@ -47,7 +45,7 @@ module.exports = {
}
return await interaction.editReply({
embeds: [new EmbedBuilder().setDescription(embedDescription).setColor(embedColors.colorInfo)]
embeds: [new EmbedBuilder().setDescription(embedDescription).setColor(embedOptions.colors.info)]
});
}
};
+11 -13
View File
@@ -1,23 +1,21 @@
const path = require('node:path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { EmbedBuilder } = require('discord.js');
const { embedOptions, systemOptions } = require('../../config');
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player');
const { embedColors, embedIcons, systemServerGuildIds } = require(path.resolve('./config.json'));
const osu = require('node-os-utils');
const packageJson = require(path.resolve('./package.json'));
const { version, dependencies } = require('../../../package.json');
module.exports = {
isSystemCommand: true,
data: new SlashCommandBuilder().setName('status').setDescription('Show bot status.').setDMPermission(false),
execute: async ({ interaction, client }) => {
if (!systemServerGuildIds.includes(interaction.guildId)) {
if (!systemOptions.systemGuildIds.includes(interaction.guildId)) {
return await interaction.editReply({
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Oops!**\nNo permission to execute this command.\n\nThe command \`${interaction.commandName}\` cannot be executed in this server.`
`**${embedOptions.icons.warning} Oops!**\nNo permission to execute this command.\n\nThe command \`${interaction.commandName}\` cannot be executed in this server.`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
@@ -32,9 +30,9 @@ module.exports = {
const cpuUsage = await osu.cpu.usage();
const cpuCores = await osu.cpu.count();
const platform = await osu.os.platform();
const releaseVersion = packageJson.version;
const discordJsVersion = packageJson.dependencies['discord.js'];
const discordPlayerVersion = packageJson.dependencies['discord-player'];
const releaseVersion = version;
const discordJsVersion = dependencies['discord.js'];
const discordPlayerVersion = dependencies['discord-player'];
const discordApiLatency = client.ws.ping;
let activeVoiceConnections = 0;
client.guilds.cache.forEach((guild) => {
@@ -49,7 +47,7 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.bot} System and bot status**\n` +
`**${embedOptions.icons.bot} System and bot status**\n` +
`Uptime: \`${uptimeString}\`\n` +
`Platform: \`${platform}\`\n` +
`CPU cores: \`${cpuCores}\`\n` +
@@ -65,7 +63,7 @@ module.exports = {
`Active voice connections: \`${activeVoiceConnections}\`\n` +
`Joined guilds: \`${client.guilds.cache.size}\``
)
.setColor(embedColors.colorInfo)
.setColor(embedOptions.colors.info)
]
});
}
+152
View File
@@ -0,0 +1,152 @@
// Description: Config file for Cadence Discord bot.
// General options for information about the bot.
module.exports.botOptions = {
name: 'Cadence',
websiteUrl: 'Unknown',
botInviteUrl: 'Unknown',
serverInviteUrl: 'Unknown'
};
// Logging options for the bot, can set logging level to file and console separately.
module.exports.loggerOptions = {
minimumLogLevel: 'debug',
minimumLogLevelConsole: 'info'
};
// systemGuildIds: Array of guild ids where system commands should be available.
// systemMessageChannelId: Channel id where system messages should be sent, such as error events.
// systemUserId: User id of the system administrator, used for pining on certain system messages.
module.exports.systemOptions = {
systemGuildIds: ['Guild id where system commands can be used'],
systemMessageChannelId: 'Channel id where system messages will be sent',
systemUserId: 'User id of the system administrator which will receive pings on certain system messages'
};
// Options for embed messages, like colors and custom emojis.
module.exports.embedOptions = {
colors: {
success: '#23A55A',
warning: '#F0B232',
error: '#F23F43',
info: '#5865F2',
note: '#80848E'
},
icons: {
logo: '🤖',
beta: '`beta`',
new: '`new`',
rule: '📒',
support: '❓',
bot: '🤖',
audioPlaying: '🎶',
audioStartedPlaying: '🎶',
success: '✅',
error: '⚠️',
warning: '⚠️',
disable: '🚫',
enable: '✅',
disabled: '✅',
enabled: '✅',
nextTrack: '⏭️',
previousTrack: '⏮️',
pauseResumeTrack: '⏯️',
shuffleQueue: '🔀',
loop: '🔁',
loopAction: '🔁',
autoplay: '♾️',
autoplayAction: '♾️',
looping: '🔁',
autoplaying: '♾️',
skipped: '⏭️',
back: '⏮️',
pauseResumed: '⏯️',
shuffled: '🔀',
volume: '🔊',
volumeIsMuted: '🔇',
volumeChanged: '🔊',
volumeMuted: '🔇',
queue: '🎶',
sourceArbitrary: '🎵',
sourceAppleMusic: '🎵',
sourceYouTube: '🎵',
sourceSoundCloud: '🎵',
sourceSpotify: '🎵'
}
};
// Options for the discord-player player.
module.exports.playerOptions = {
leaveOnEmpty: true,
leaveOnEmptyCooldown: 300000,
leaveOnEnd: true,
leaveonEndCooldown: 300000,
leaveOnStop: true,
leaveOnStopCooldown: 300000,
defaultVolume: 50,
maxQueueSize: 1000,
maxHistorySize: 100,
progressBar: {
length: 14,
timecodes: false,
separator: '┃',
indicator: '🔘',
leftChar: '▬',
rightChar: '▬'
}
};
// Options to be used by the ffmpeg, and available ffmpeg filters shown in filter commands.
module.exports.ffmpegFilterOptions = {
threadAmount: '2',
filterList: [
{
label: 'Bass boost',
value: 'bassboost_low',
description: 'Boost the bass of the audio.',
emoji: '🔉'
},
{
label: 'Bass boost high',
value: 'bassboost',
description: 'Boost the bass of the audio a lot.',
emoji: '🔊'
},
{
label: 'Night core',
value: 'nightcore',
description: 'Speed up the audio (higher pitch).',
emoji: '🐱'
},
{
label: 'Lo-fi',
value: 'lofi',
description: 'Low fidelity effect (lower quality).',
emoji: '📻'
},
{
label: 'Vaporwave',
value: 'vaporwave',
description: 'Slow down the audio (lower pitch).',
emoji: '🌸'
},
{
label: 'Ear rape',
value: 'earrape',
description: 'Extremely loud and distorted audio.',
emoji: '👂'
},
{
label: '8D',
value: '8D',
description: 'Simulate 8D audio effect (surround).',
emoji: '🎧'
},
{
label: 'Treble',
value: 'treble',
description: 'Increase the high frequencies.',
emoji: '🎼'
}
]
};
+1 -2
View File
@@ -1,5 +1,4 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
const logger = require('../../services/logger');
const { Events } = require('discord.js');
module.exports = {
+7 -8
View File
@@ -1,7 +1,6 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
const logger = require('../../services/logger');
const { embedOptions, systemOptions } = require('../../config');
const { EmbedBuilder } = require('discord.js');
const { systemMessageChannelId, systemUserId, embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = {
name: 'disconnect',
@@ -11,15 +10,15 @@ module.exports = {
logger.warn(`${client.user.tag} lost connection to Discord APIs. Disconnected.`);
// send message to system message channel for event
if (systemMessageChannelId && systemUserId) {
await client.channels.cache.get(systemMessageChannelId).send({
if (systemOptions.systemMessageChannelId && systemOptions.systemUserId) {
await client.channels.cache.get(systemOptions.systemMessageChannelId).send({
embeds: [
new EmbedBuilder()
.setDescription(
`${embedIcons.warning} **${client.user.tag}** is **\`disconnected\`**!` +
`\n<@${systemUserId}>`
`${embedOptions.icons.warning} **${client.user.tag}** is **\`disconnected\`**!` +
`\n<@${systemOptions.systemUserId}>`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
+1 -2
View File
@@ -1,5 +1,4 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
const logger = require('../../services/logger');
const { Events } = require('discord.js');
module.exports = {
+1 -2
View File
@@ -1,5 +1,4 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
const logger = require('../../services/logger');
const { Events } = require('discord.js');
module.exports = {
+1 -2
View File
@@ -1,5 +1,4 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
const logger = require('../../services/logger');
const { Events } = require('discord.js');
module.exports = {
+7 -8
View File
@@ -1,8 +1,7 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
const logger = require('../../services/logger');
const { embedOptions, systemOptions } = require('../../config');
const { Events, ActivityType, PresenceUpdateStatus, EmbedBuilder } = require('discord.js');
const { postBotStats } = require(path.resolve('./src/utils/postBotStats.js'));
const { systemMessageChannelId, embedColors, embedIcons } = require(path.resolve('./config.json'));
const { postBotStats } = require('../../utils/postBotStats.js');
module.exports = {
name: Events.ClientReady,
@@ -24,12 +23,12 @@ module.exports = {
process.env.NODE_ENV === 'production' ? postBotStats(client) : null;
// send message to system message channel for event
if (systemMessageChannelId) {
await client.channels.cache.get(systemMessageChannelId).send({
if (systemOptions.systemMessageChannelId) {
await client.channels.cache.get(systemOptions.systemMessageChannelId).send({
embeds: [
new EmbedBuilder()
.setDescription(`${embedIcons.success} **${client.user.tag}** is now **\`online\`**!`)
.setColor(embedColors.colorSuccess)
.setDescription(`${embedOptions.icons.success} **${client.user.tag}** is now **\`online\`**!`)
.setColor(embedOptions.colors.success)
]
});
}
+7 -8
View File
@@ -1,7 +1,6 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
const logger = require('../../services/logger');
const { embedOptions, systemOptions } = require('../../config');
const { EmbedBuilder } = require('discord.js');
const { systemMessageChannelId, systemUserId, embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = {
name: 'reconnecting',
@@ -11,15 +10,15 @@ module.exports = {
logger.warn(`${client.user.tag} is reconnecting to Discord APIs.`);
// send message to system message channel for event
if (systemMessageChannelId && systemUserId) {
await client.channels.cache.get(systemMessageChannelId).send({
if (systemOptions.systemMessageChannelId && systemOptions.systemUserId) {
await client.channels.cache.get(systemOptions.systemMessageChannelId).send({
embeds: [
new EmbedBuilder()
.setDescription(
`${embedIcons.warning} **${client.user.tag}** is **\`reconnecting\`**!` +
`\n<@${systemUserId}>`
`${embedOptions.icons.warning} **${client.user.tag}** is **\`reconnecting\`**!` +
`\n<@${systemOptions.systemUserId}>`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
}
+1 -2
View File
@@ -1,5 +1,4 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
const logger = require('../../services/logger');
const { Events } = require('discord.js');
module.exports = {
+6 -7
View File
@@ -1,7 +1,6 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
const logger = require('../../services/logger');
const { embedOptions, botOptions } = require('../../config');
const { Events, EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons, botInfo } = require(path.resolve('./config.json'));
module.exports = {
name: Events.InteractionCreate,
@@ -46,11 +45,11 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.warning} Warning**\nThis command took ${
`**${embedOptions.icons.warning} Warning**\nThis command took ${
executionTime / 1000
} seconds to execute.\n\n_If you experienced problems with the command, please try again._`
)
.setColor(embedColors.colorWarning)
.setColor(embedOptions.colors.warning)
]
});
} else {
@@ -68,9 +67,9 @@ module.exports = {
embeds: [
new EmbedBuilder()
.setDescription(
`**${embedIcons.error} Uh-oh... _Something_ went wrong!**\nThere was an unexpected error while trying to execute this command.\n\nYou can try to perform the command again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botInfo.supportServerInviteUrl})**._`
`**${embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nThere was an unexpected error while trying to execute this command.\n\nYou can try to perform the command again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
)
.setColor(embedColors.colorError)
.setColor(embedOptions.colors.error)
]
});
}
+1 -3
View File
@@ -1,6 +1,4 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
require('dotenv').config();
const logger = require('../../services/logger');
// Emitted when the player queue encounters error
module.exports = {
+1 -3
View File
@@ -1,6 +1,4 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
require('dotenv').config();
const logger = require('../../services/logger');
module.exports = {
name: 'debug',
+1 -2
View File
@@ -1,5 +1,4 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
const logger = require('../../services/logger');
module.exports = {
name: 'error',
+1 -2
View File
@@ -1,5 +1,4 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
const logger = require('../../services/logger');
module.exports = {
name: 'error',
+1 -3
View File
@@ -1,6 +1,4 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
require('dotenv').config();
const logger = require('../../services/logger');
module.exports = {
name: 'playerSkip',
+1 -3
View File
@@ -1,6 +1,4 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
require('dotenv').config();
const logger = require('../../services/logger');
module.exports = {
name: 'playerStart',
+1 -3
View File
@@ -1,6 +1,4 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
require('dotenv').config();
const logger = require('../../services/logger');
module.exports = {
name: 'uncaughtException',
+1 -3
View File
@@ -1,6 +1,4 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
require('dotenv').config();
const logger = require('../../services/logger');
module.exports = {
name: 'unhandledRejection',
+6 -9
View File
@@ -1,11 +1,10 @@
require('dotenv').config();
const fs = require('node:fs');
const path = require('node:path');
const Discord = require('discord.js');
const logger = require(path.resolve('./src/services/logger.js'));
const logger = require('./services/logger');
const { Player, onBeforeCreateStream } = require('discord-player');
const { stream } = require('yt-stream');
const { registerEventListeners } = require(path.resolve('./src/utils/registerEventListeners.js'));
require('dotenv').config();
const { registerEventListeners } = require('./utils/registerEventListeners.js');
const client = new Discord.Client({
intents: [Discord.GatewayIntentBits.Guilds, Discord.GatewayIntentBits.GuildVoiceStates],
@@ -62,14 +61,12 @@ onBeforeCreateStream(async (track) => {
});
client.commands = new Discord.Collection();
const commandFolders = fs.readdirSync(path.resolve('./src/commands'));
const commandFolders = fs.readdirSync('./src/commands');
for (const folder of commandFolders) {
const commandFiles = fs
.readdirSync(path.resolve(`./src/commands/${folder}`))
.filter((file) => file.endsWith('.js'));
const commandFiles = fs.readdirSync(`./src/commands/${folder}`).filter((file) => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(path.resolve(`./src/commands/${folder}/${file}`));
const command = require(`./commands/${folder}/${file}`);
client.commands.set(command.data.name, command);
}
}
+4 -4
View File
@@ -1,11 +1,11 @@
const pino = require('pino');
require('dotenv').config();
const { loggerOptions } = require('../config');
const transport = pino.transport({
targets: [
{
target: 'pino/file',
level: process.env.MINIMUM_LOG_LEVEL,
level: loggerOptions.minimumLogLevel,
options: {
destination: './logs/app-all.log',
mkdir: true,
@@ -34,7 +34,7 @@ const transport = pino.transport({
},
{
target: 'pino/file',
level: process.env.MINIMUM_LOG_LEVEL_CONSOLE,
level: loggerOptions.minimumLogLevelConsole,
options: {
colorize: true,
sync: false
@@ -45,7 +45,7 @@ const transport = pino.transport({
module.exports = pino(
{
level: process.env.MINIMUM_LOG_LEVEL,
level: loggerOptions.minimumLogLevel,
timestamp: () => `,"timestamp":"${new Date(Date.now()).toISOString()}"`,
base: undefined
},
+11 -14
View File
@@ -1,20 +1,17 @@
const path = require('node:path');
const fs = require('node:fs');
const logger = require(path.resolve('./src/services/logger.js'));
const { REST, Routes } = require('discord.js');
const { systemServerGuildIds } = require(path.resolve('./config.json'));
require('dotenv').config();
const logger = require('../services/logger');
const fs = require('node:fs');
const { REST, Routes } = require('discord.js');
const { systemOptions } = require('../config');
const slashCommands = [];
const systemCommands = [];
const commandFolders = fs.readdirSync(path.resolve('./src/commands'));
const commandFolders = fs.readdirSync('./src/commands');
for (const folder of commandFolders) {
const commandFiles = fs
.readdirSync(path.resolve(`./src/commands/${folder}`))
.filter((file) => file.endsWith('.js'));
const commandFiles = fs.readdirSync(`./src/commands/${folder}`).filter((file) => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(path.resolve(`./src/commands/${folder}/${file}`));
const command = require(`../commands/${folder}/${file}`);
command.isSystemCommand
? systemCommands.push(command.data.toJSON())
: slashCommands.push(command.data.toJSON());
@@ -34,7 +31,7 @@ const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_BOT_TOKEN)
);
logger.info('Started refreshing application (/) bot commands.');
await rest.put(Routes.applicationCommands(process.env.DISCORD_CLIENT_ID), {
await rest.put(Routes.applicationCommands(process.env.DISCORD_APPLICATION_ID), {
body: slashCommands
});
@@ -53,9 +50,9 @@ const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_BOT_TOKEN)
);
logger.info('Started refreshing application (/) system commands.');
for (const systemServerGuildId of systemServerGuildIds) {
logger.info(`Refreshing system commands for guild id ${systemServerGuildId}.`);
await rest.put(Routes.applicationGuildCommands(process.env.DISCORD_CLIENT_ID, systemServerGuildId), {
for (const systemGuildId of systemOptions.systemGuildIds) {
logger.info(`Refreshing system commands for guild id ${systemGuildId}.`);
await rest.put(Routes.applicationGuildCommands(process.env.DISCORD_APPLICATION_ID, systemGuildId), {
body: systemCommands
});
}
+7 -9
View File
@@ -1,7 +1,5 @@
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
const logger = require('../services/logger');
const https = require('node:https');
require('dotenv').config();
exports.postBotStats = (client) => {
try {
@@ -11,42 +9,42 @@ exports.postBotStats = (client) => {
const sites = [
{
hostname: 'top.gg',
path: `/api/bots/${process.env.DISCORD_CLIENT_ID}/stats`,
path: `/api/bots/${process.env.DISCORD_APPLICATION_ID}/stats`,
method: 'POST',
body: { server_count: guildCount },
token: process.env.BOTLIST_TOP_GG_API_TOKEN
},
{
hostname: 'discordbotlist.com',
path: `/api/v1/bots/${process.env.DISCORD_CLIENT_ID}/stats`,
path: `/api/v1/bots/${process.env.DISCORD_APPLICATION_ID}/stats`,
method: 'POST',
body: { guilds: guildCount },
token: process.env.BOTLIST_DISCORD_BOT_LIST_COM_API_TOKEN
},
{
hostname: 'discords.com',
path: `/bots/api/bot/${process.env.DISCORD_CLIENT_ID}`,
path: `/bots/api/bot/${process.env.DISCORD_APPLICATION_ID}`,
method: 'POST',
body: { server_count: guildCount },
token: process.env.BOTLIST_DISCORDS_COM_API_TOKEN
},
{
hostname: 'discord.bots.gg',
path: `/api/v1/bots/${process.env.DISCORD_CLIENT_ID}/stats`,
path: `/api/v1/bots/${process.env.DISCORD_APPLICATION_ID}/stats`,
method: 'POST',
body: { guildCount: guildCount },
token: process.env.BOTLIST_DISCORD_BOTS_GG_API_TOKEN
},
{
hostname: 'api.botlist.me',
path: `/api/v1/bots/${process.env.DISCORD_CLIENT_ID}/stats`,
path: `/api/v1/bots/${process.env.DISCORD_APPLICATION_ID}/stats`,
method: 'POST',
body: { server_count: guildCount },
token: process.env.BOTLIST_BOTLIST_ME_API_TOKEN
},
{
hostname: 'api.discordlist.gg',
path: `/v0/bots/${process.env.DISCORD_CLIENT_ID}/guilds?count=${guildCount}`,
path: `/v0/bots/${process.env.DISCORD_APPLICATION_ID}/guilds?count=${guildCount}`,
method: 'PUT',
body: {},
token: `Bearer ${process.env.BOTLIST_DISCORDLIST_GG_API_TOKEN}`
+4 -8
View File
@@ -1,17 +1,13 @@
const logger = require('../services/logger');
const fs = require('node:fs');
const path = require('node:path');
const logger = require(path.resolve('./src/services/logger.js'));
require('dotenv').config();
exports.registerEventListeners = (client, player) => {
const eventFolders = fs.readdirSync(path.resolve('./src/events'));
const eventFolders = fs.readdirSync('./src/events');
for (const folder of eventFolders) {
const eventFiles = fs
.readdirSync(path.resolve(`./src/events/${folder}`))
.filter((file) => file.endsWith('.js'));
const eventFiles = fs.readdirSync(`./src/events/${folder}`).filter((file) => file.endsWith('.js'));
for (const file of eventFiles) {
const event = require(path.resolve(`./src/events/${folder}/${file}`));
const event = require(`../events/${folder}/${file}`);
switch (folder) {
case 'client':
if (event.once) {