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

+17 -5
View File
@@ -1,14 +1,26 @@
# This file contains all the environment variables that are used by the bot.
# For production use, set NODE_ENV to production
# For development use, set NODE_ENV to development
NODE_ENV=development NODE_ENV=development
MINIMUM_LOG_LEVEL=debug
MINIMUM_LOG_LEVEL_CONSOLE=info # Required: Login credentials for the bot
# Retrieve your bot token and application id from https://discordapp.com/developers/applications/me
DISCORD_BOT_TOKEN=YOUR_DISCORD_BOT_TOKEN DISCORD_BOT_TOKEN=YOUR_DISCORD_BOT_TOKEN
DISCORD_CLIENT_ID=YOUR_DISCOR_BOT_CLIENT_ID DISCORD_APPLICATION_ID=YOUR_DISCORD_BOT_APPLICATION_ID
UV_THREADPOOL_SIZE=4
NODE_OPTIONS= # Optional: Set a YouTube cookie to reduce the chance of getting rate limited / 429 Too Many Requests
YOUTUBE_COOKIE= YOUTUBE_COOKIE=
# Optional: Authentication tokens for botlist websites to automatically update server count, etc.
# See /src/utils/postBotStats.js for more information
BOTLIST_TOP_GG_API_TOKEN= BOTLIST_TOP_GG_API_TOKEN=
BOTLIST_DISCORD_BOT_LIST_COM_API_TOKEN= BOTLIST_DISCORD_BOT_LIST_COM_API_TOKEN=
BOTLIST_DISCORDS_COM_API_TOKEN= BOTLIST_DISCORDS_COM_API_TOKEN=
BOTLIST_DISCORD_BOTS_GG_API_TOKEN= BOTLIST_DISCORD_BOTS_GG_API_TOKEN=
BOTLIST_BOTLIST_ME_API_TOKEN= BOTLIST_BOTLIST_ME_API_TOKEN=
BOTLIST_DISCORDLIST_GG_API_TOKEN= BOTLIST_DISCORDLIST_GG_API_TOKEN=
# Optional: Only change this if you know what you are doing
NODE_OPTIONS=
UV_THREADPOOL_SIZE=
+1
View File
@@ -1,5 +1,6 @@
/node_modules /node_modules
/config.json /config.json
/src/config.js
/.env /.env
/app-*.log /app-*.log
/logs /logs
-132
View File
@@ -1,132 +0,0 @@
{
"botInfo": {
"name": "Cadence",
"websiteUrl": "Unknown",
"botInviteUrl": "Unknown",
"supportServerInviteUrl": "Unknown"
},
"systemServerGuildIds": [
"Server id where system commands can be used",
"Another server id where system commands can be used"
],
"systemMessageChannelId": "",
"systemUserId": "",
"embedColors": {
"colorSuccess": "#23A55A",
"colorWarning": "#F0B232",
"colorError": "#F23F43",
"colorInfo": "#5865F2",
"colorNote": "#80848E"
},
"playerOptions": {
"leaveOnEmpty": true,
"leaveOnEmptyCooldown": 60000,
"leaveOnEnd": true,
"leaveonEndCooldown": 60000,
"leaveOnStop": true,
"leaveOnStopCooldown": 60000,
"defaultVolume": 50,
"maxQueueSize": 1000,
"maxHistorySize": 100
},
"progressBarOptions": {
"length": 14,
"timecodes": false,
"separator": "┃",
"indicator": "🔘",
"leftChar": "▬",
"rightChar": "▬"
},
"embedIcons": {
"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": "🎵"
},
"filterThreadAmount": "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": "🎼"
}
]
}
+8 -10
View File
@@ -1,7 +1,5 @@
const path = require('node:path'); const { embedOptions, botOptions } = require('../../config');
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons, botInfo } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -13,22 +11,22 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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' + '- **`/play` `query`** - Add a track or playlist to the queue by url or search.\n' +
'- **`/pause`** - Pause or resume the current track.\n' + '- **`/pause`** - Pause or resume the current track.\n' +
'- **`/queue` `[page]`** - Show the list of tracks added to the queue.\n' + '- **`/queue` `[page]`** - Show the list of tracks added to the queue.\n' +
'- **`/nowplaying`** - Show information about the track currently playing.\n' + '- **`/nowplaying`** - Show information about the track currently playing.\n' +
`- **\`/seek\` \`duration\`** - ${embedIcons.new} Seek to a specified duration in the current track.\n` + `- **\`/seek\` \`duration\`** - ${embedOptions.icons.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` + `- **\`/loop\` \`mode\`** - ${embedOptions.icons.beta} Toggle looping a track, the whole queue or autoplay.\n` +
'- **`/filters`** - Toggle various audio filters during playback.\n' + '- **`/filters`** - Toggle various audio filters during playback.\n' +
'- **`/volume` `[percentage]`** - Show or set the playback volume for tracks.\n' + '- **`/volume` `[percentage]`** - Show or set the playback volume for tracks.\n' +
'- **`/skip` `[tracknumber]`** - Skip to next or specified track.\n' + '- **`/skip` `[tracknumber]`** - Skip to next or specified track.\n' +
'- **`/remove` `tracknumber`** - Remove specified track from the queue.\n' + '- **`/remove` `tracknumber`** - Remove specified track from the queue.\n' +
'- **`/leave`** - Clear the queue and remove the bot from voice channel.\n\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` + `${embedOptions.icons.support} **Support server**\nJoin the support server for help or suggestions: \n**${botOptions.serverInviteUrl}**\n\n` +
`${embedIcons.bot} **Enjoying ${botInfo.name}?**\nAdd me to another server: \n**[Click me!](${botInfo.botInviteUrl})**` `${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 { embedOptions, ffmpegFilterOptions } = require('../../config');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { useQueue } = require('discord-player');
const { const {
SlashCommandBuilder,
EmbedBuilder, EmbedBuilder,
ActionRowBuilder,
StringSelectMenuBuilder, StringSelectMenuBuilder,
StringSelectMenuOptionBuilder, StringSelectMenuOptionBuilder,
ActionRowBuilder,
ButtonBuilder ButtonBuilder
} = require('discord.js'); } = require('discord.js');
const { embedColors, embedIcons, filterList, filterThreadAmount } = require(path.resolve('./config.json')); const { useQueue } = require('discord-player');
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -21,9 +20,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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 = []; let filterOptions = [];
filterList.forEach((filter) => { ffmpegFilterOptions.availableFilters.forEach((filter) => {
let isEnabled = false; let isEnabled = false;
if (queue.filters.ffmpeg.filters.includes(filter.value)) { if (queue.filters.ffmpeg.filters.includes(filter.value)) {
@@ -75,16 +74,16 @@ module.exports = {
.setCustomId('disable-filters') .setCustomId('disable-filters')
.setLabel('Disable all filters') .setLabel('Disable all filters')
.setStyle('Secondary') .setStyle('Secondary')
.setEmoji(embedIcons.disable) .setEmoji(embedOptions.icons.disable)
); );
const response = await interaction.editReply({ const response = await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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] components: [filterActionRow, disableFiltersActionRow]
}); });
@@ -100,7 +99,7 @@ module.exports = {
queue.filters.ffmpeg.setInputArgs([ queue.filters.ffmpeg.setInputArgs([
'-threads', '-threads',
filterThreadAmount, ffmpegFilterOptions.threadAmount,
'-reconnect', '-reconnect',
'1', '1',
'-reconnect_streamed', '-reconnect_streamed',
@@ -124,9 +123,9 @@ module.exports = {
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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: [] components: []
}); });
@@ -143,11 +142,20 @@ module.exports = {
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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(', ')}.` .join(', ')}.`
) )
.setColor(embedColors.colorSuccess) .setColor(embedOptions.colors.success)
], ],
components: [] components: []
}); });
+8 -10
View File
@@ -1,8 +1,6 @@
const path = require('node:path'); const { embedOptions } = require('../../config');
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player'); const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -17,9 +15,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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 { embedOptions, botOptions } = require('../../config');
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player'); const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons, botInfo } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -27,9 +25,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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() new EmbedBuilder()
.setDescription( .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}\`.` } 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({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription(`**${embedIcons.warning} Oops!**\nLoop mode is already \`${modeUserString}\`.`) .setDescription(
.setColor(embedColors.colorWarning) `**${embedOptions.icons.warning} Oops!**\nLoop mode is already \`${modeUserString}\`.`
)
.setColor(embedOptions.colors.warning)
] ]
}); });
} }
@@ -91,9 +91,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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 { embedOptions, playerOptions } = require('../../config');
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');
const { useQueue } = require('discord-player'); const { useQueue } = require('discord-player');
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');
const { embedColors, embedIcons, progressBarOptions } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -15,9 +13,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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([ const sourceIcons = new Map([
['youtube', embedIcons.sourceYouTube], ['youtube', embedOptions.icons.sourceYouTube],
['soundcloud', embedIcons.sourceSoundCloud], ['soundcloud', embedOptions.icons.sourceSoundCloud],
['spotify', embedIcons.sourceSpotify], ['spotify', embedOptions.icons.sourceSpotify],
['apple_music', embedIcons.sourceAppleMusic], ['apple_music', embedOptions.icons.sourceAppleMusic],
['arbitrary', embedIcons.sourceArbitrary] ['arbitrary', embedOptions.icons.sourceArbitrary]
]); ]);
const currentTrack = queue.currentTrack; const currentTrack = queue.currentTrack;
@@ -88,11 +86,11 @@ module.exports = {
const timestamp = queue.node.getTimestamp(); const timestamp = queue.node.getTimestamp();
let bar = `**\`${timestamp.current.label}\`** ${queue.node.createProgressBar({ let bar = `**\`${timestamp.current.label}\`** ${queue.node.createProgressBar({
queue: false, queue: false,
length: progressBarOptions.length ?? 12, length: playerOptions.progressBar.length ?? 12,
timecodes: progressBarOptions.timecodes ?? false, timecodes: playerOptions.progressBar.timecodes ?? false,
indicator: progressBarOptions.indicator ?? '🔘', indicator: playerOptions.progressBar.indicator ?? '🔘',
leftChar: progressBarOptions.leftChar ?? '▬', leftChar: playerOptions.progressBar.leftChar ?? '▬',
rightChar: progressBarOptions.rightChar ?? '▬' rightChar: playerOptions.progressBar.rightChar ?? '▬'
})} **\`${timestamp.total.label}\`**`; })} **\`${timestamp.total.label}\`**`;
if (currentTrack.raw.duration === 0 || currentTrack.duration === '0:00') { if (currentTrack.raw.duration === 0 || currentTrack.duration === '0:00') {
@@ -104,7 +102,7 @@ module.exports = {
.setCustomId('nowplaying-skip') .setCustomId('nowplaying-skip')
.setLabel('Skip track') .setLabel('Skip track')
.setStyle('Secondary') .setStyle('Secondary')
.setEmoji(embedIcons.nextTrack) .setEmoji(embedOptions.icons.nextTrack)
); );
const loopModesFormatted = new Map([ const loopModesFormatted = new Map([
@@ -126,7 +124,7 @@ module.exports = {
.setDescription( .setDescription(
(queue.node.isPaused() (queue.node.isPaused()
? '**Currently Paused**\n' ? '**Currently Paused**\n'
: `**${embedIcons.audioPlaying} Now Playing**\n`) + : `**${embedOptions.icons.audioPlaying} Now Playing**\n`) +
`**[${currentTrack.title}](${currentTrack.url})**` + `**[${currentTrack.title}](${currentTrack.url})**` +
`\nRequested by: <@${currentTrack.requestedBy.id}>` + `\nRequested by: <@${currentTrack.requestedBy.id}>` +
`\n ${bar}\n\n` + `\n ${bar}\n\n` +
@@ -134,7 +132,7 @@ module.exports = {
queue.repeatMode === 0 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\`**.` } 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...` : ' ' text: queueLength ? `${queueLength} other tracks in the queue...` : ' '
}) })
.setThumbnail(queue.currentTrack.thumbnail) .setThumbnail(queue.currentTrack.thumbnail)
.setColor(embedColors.colorInfo) .setColor(embedOptions.colors.info)
], ],
components: [nowPlayingActionRow] components: [nowPlayingActionRow]
}); });
@@ -179,9 +177,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [] components: []
}); });
@@ -192,9 +190,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [] components: []
}); });
@@ -217,17 +215,19 @@ module.exports = {
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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 queue.repeatMode === 0
? '' ? ''
: `\n\n**${ : `\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\`**.` } Looping**\nLoop mode is set to ${repeatModeUserString}. You can change it with **\`/loop\`**.`
}` }`
) )
.setThumbnail(skippedTrack.thumbnail) .setThumbnail(skippedTrack.thumbnail)
.setColor(embedColors.colorSuccess) .setColor(embedOptions.colors.success)
], ],
components: [] components: []
}); });
+10 -12
View File
@@ -1,8 +1,6 @@
const path = require('node:path'); const { embedOptions } = require('../../config');
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player'); const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -15,9 +13,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .setDescription(
`**${embedIcons.pauseResumed} ${ `**${embedOptions.icons.pauseResumed} ${
queue.node.isPaused() ? 'Paused Track' : 'Resumed track' queue.node.isPaused() ? 'Paused Track' : 'Resumed track'
}**\n**${durationFormat} [${queue.currentTrack.title}](${queue.currentTrack.url})**` }**\n**${durationFormat} [${queue.currentTrack.title}](${queue.currentTrack.url})**`
) )
.setThumbnail(queue.currentTrack.thumbnail) .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 { embedOptions, playerOptions, botOptions } = require('../../config');
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useMainPlayer, useQueue } = require('discord-player'); const { useMainPlayer, useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons, playerOptions, botInfo } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -16,9 +14,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .setDescription(
`**${embedIcons.success} Added playlist to queue**\n**${durationFormat} [${track.title}](${ `**${embedOptions.icons.success} Added playlist to queue**\n**${durationFormat} [${
track.url track.title
})**\n\nAnd **${ }](${track.url})**\n\nAnd **${
searchResult.tracks.length - 1 searchResult.tracks.length - 1
}** more tracks... **\`/queue\`** to view all.` }** more tracks... **\`/queue\`** to view all.`
) )
.setThumbnail(track.thumbnail) .setThumbnail(track.thumbnail)
.setColor(embedColors.colorSuccess) .setColor(embedOptions.colors.success)
] ]
}); });
} }
@@ -170,10 +168,10 @@ module.exports = {
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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) .setThumbnail(track.thumbnail)
.setColor(embedColors.colorSuccess) .setColor(embedOptions.colors.success)
] ]
}); });
} }
@@ -186,10 +184,10 @@ module.exports = {
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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) .setThumbnail(track.thumbnail)
.setColor(embedColors.colorSuccess) .setColor(embedOptions.colors.success)
] ]
}); });
} }
+21 -23
View File
@@ -1,8 +1,6 @@
const path = require('node:path'); const { embedOptions, playerOptions } = require('../../config');
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player'); const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons, progressBarOptions } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -16,9 +14,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .setDescription(
`**${embedIcons.warning} Oops!**\nPage \`${ `**${embedOptions.icons.warning} Oops!**\nPage \`${
pageIndex + 1 pageIndex + 1
}\` is not a valid page number.\n\nThe queue is currently empty, first add some tracks with **\`/play\`**!` }\` 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, name: interaction.guild.name,
iconURL: interaction.guild.iconURL() iconURL: interaction.guild.iconURL()
}) })
.setDescription(`**${embedIcons.queue} Tracks in queue**\n${queueString}`) .setDescription(`**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`)
.setColor(embedColors.colorInfo) .setColor(embedOptions.colors.info)
.setFooter({ .setFooter({
text: 'Page 1 of 1' text: 'Page 1 of 1'
}) })
@@ -66,11 +64,11 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .setDescription(
`**${embedIcons.warning} Oops!**\nPage \`${ `**${embedOptions.icons.warning} Oops!**\nPage \`${
pageIndex + 1 pageIndex + 1
}\` is not a valid page number.\n\nThere are only a total of \`${totalPages}\` pages in the queue.` }\` 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 === 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` } 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() iconURL: interaction.guild.iconURL()
}) })
.setDescription( .setDescription(
`${repeatModeString}` + `**${embedIcons.queue} Tracks in queue**\n${queueString}` `${repeatModeString}` + `**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`
) )
.setFooter({ .setFooter({
text: `Page ${pageIndex + 1} of ${totalPages}` text: `Page ${pageIndex + 1} of ${totalPages}`
}) })
.setColor(embedColors.colorInfo) .setColor(embedOptions.colors.info)
] ]
}); });
} else { } else {
const timestamp = queue.node.getTimestamp(); const timestamp = queue.node.getTimestamp();
let bar = `**\`${timestamp.current.label}\`** ${queue.node.createProgressBar({ let bar = `**\`${timestamp.current.label}\`** ${queue.node.createProgressBar({
queue: false, queue: false,
length: progressBarOptions.length ?? 12, length: playerOptions.progressBar.length ?? 12,
timecodes: progressBarOptions.timecodes ?? false, timecodes: playerOptions.progressBar.timecodes ?? false,
indicator: progressBarOptions.indicator ?? '🔘', indicator: playerOptions.progressBar.indicator ?? '🔘',
leftChar: progressBarOptions.leftChar ?? '▬', leftChar: playerOptions.progressBar.leftChar ?? '▬',
rightChar: progressBarOptions.rightChar ?? '▬' rightChar: playerOptions.progressBar.rightChar ?? '▬'
})} **\`${timestamp.total.label}\`**`; })} **\`${timestamp.total.label}\`**`;
if (currentTrack.raw.duration === 0 || currentTrack.duration === '0:00') { if (currentTrack.raw.duration === 0 || currentTrack.duration === '0:00') {
@@ -148,18 +146,18 @@ module.exports = {
iconURL: interaction.guild.iconURL() iconURL: interaction.guild.iconURL()
}) })
.setDescription( .setDescription(
`**${embedIcons.audioPlaying} Now playing**\n` + `**${embedOptions.icons.audioPlaying} Now playing**\n` +
(currentTrack ? `**[${currentTrack.title}](${currentTrack.url})**` : 'None') + (currentTrack ? `**[${currentTrack.title}](${currentTrack.url})**` : 'None') +
`\nRequested by: <@${currentTrack.requestedBy.id}>` + `\nRequested by: <@${currentTrack.requestedBy.id}>` +
`\n ${bar}\n\n` + `\n ${bar}\n\n` +
`${repeatModeString}` + `${repeatModeString}` +
`**${embedIcons.queue} Tracks in queue**\n${queueString}` `**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`
) )
.setThumbnail(queue.currentTrack.thumbnail) .setThumbnail(queue.currentTrack.thumbnail)
.setFooter({ .setFooter({
text: `Page ${pageIndex + 1} of ${totalPages}` 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 { embedOptions } = require('../../config');
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player'); const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -22,9 +20,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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) .setThumbnail(removedTrack.thumbnail)
.setColor(embedColors.colorSuccess) .setColor(embedOptions.colors.success)
] ]
}); });
} }
+18 -20
View File
@@ -1,8 +1,6 @@
const path = require('node:path'); const { embedOptions } = require('../../config');
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player'); const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -21,9 +19,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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` **`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` **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
'- `/seek` **`42`** - Seek to 42 seconds.' '- `/seek` **`42`** - Seek to 42 seconds.'
) )
.setColor(embedColors.colorWarning) .setColor(embedOptions.colors.warning)
] ]
}); });
} }
@@ -98,12 +96,12 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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` **`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` **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
'- `/seek` **`42`** - Seek to 42 seconds.' '- `/seek` **`42`** - Seek to 42 seconds.'
) )
.setColor(embedColors.colorWarning) .setColor(embedOptions.colors.warning)
] ]
}); });
} }
@@ -118,12 +116,12 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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` **`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` **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
'- `/seek` **`42`** - Seek to 42 seconds.' '- `/seek` **`42`** - Seek to 42 seconds.'
) )
.setColor(embedColors.colorWarning) .setColor(embedOptions.colors.warning)
] ]
}); });
} }
@@ -136,9 +134,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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) .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 { embedOptions } = require('../../config');
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player'); const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -18,9 +16,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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 { } else {
@@ -68,10 +66,10 @@ module.exports = {
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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) .setThumbnail(skippedTrack.thumbnail)
.setColor(embedColors.colorSuccess) .setColor(embedOptions.colors.success)
] ]
}); });
} }
@@ -81,9 +79,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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 queue.repeatMode === 0
? '' ? ''
: `\n\n**${ : `\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\`**.` } Looping**\nLoop mode is set to ${loopModeUserString}. You can change it with **\`/loop\`**.`
}` }`
) )
.setThumbnail(skippedTrack.thumbnail) .setThumbnail(skippedTrack.thumbnail)
.setColor(embedColors.colorSuccess) .setColor(embedOptions.colors.success)
] ]
}); });
} }
+14 -16
View File
@@ -1,8 +1,6 @@
const path = require('node:path'); const { embedOptions } = require('../../config');
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player'); const { useQueue } = require('discord-player');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@@ -22,9 +20,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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() new EmbedBuilder()
.setDescription( .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}%\`.` } Playback volume**\nThe playback volume is currently set to \`${currentVolume}%\`.`
) )
.setColor(embedColors.colorInfo) .setColor(embedOptions.colors.info)
] ]
}); });
} else if (volume > 100 || volume < 0) { } else if (volume > 100 || volume < 0) {
@@ -64,9 +62,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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 { } else {
@@ -81,9 +79,9 @@ module.exports = {
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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 { embedOptions, systemOptions } = require('../../config');
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons, systemServerGuildIds } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
isSystemCommand: true, isSystemCommand: true,
@@ -10,14 +8,14 @@ module.exports = {
.setDescription('Show list of guilds where bot is added.') .setDescription('Show list of guilds where bot is added.')
.setDMPermission(false), .setDMPermission(false),
execute: async ({ interaction, client }) => { execute: async ({ interaction, client }) => {
if (!systemServerGuildIds.includes(interaction.guildId)) { if (!systemOptions.systemGuildIds.includes(interaction.guildId)) {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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); const totalMemberCount = client.guilds.cache.reduce((a, b) => a + b.memberCount, 0);
let embedDescription = let embedDescription =
`**${embedIcons.bot} ${ `**${embedOptions.icons.bot} ${
client.guilds.cache.size < 50 ? `Top ${client.guilds.cache.size} guilds` : 'Top 50 guilds' client.guilds.cache.size < 50 ? `Top ${client.guilds.cache.size} guilds` : 'Top 50 guilds'
} by member count (${client.guilds.cache.size} total)**\n${guildsList}` + } by member count (${client.guilds.cache.size} total)**\n${guildsList}` +
`\n\n**Total members:** \`${totalMemberCount}\``; `\n\n**Total members:** \`${totalMemberCount}\``;
@@ -47,7 +45,7 @@ module.exports = {
} }
return await interaction.editReply({ 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 { embedOptions, systemOptions } = require('../../config');
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { EmbedBuilder } = require('discord.js');
const { useQueue } = require('discord-player'); const { useQueue } = require('discord-player');
const { embedColors, embedIcons, systemServerGuildIds } = require(path.resolve('./config.json'));
const osu = require('node-os-utils'); const osu = require('node-os-utils');
const packageJson = require(path.resolve('./package.json')); const { version, dependencies } = require('../../../package.json');
module.exports = { module.exports = {
isSystemCommand: true, isSystemCommand: true,
data: new SlashCommandBuilder().setName('status').setDescription('Show bot status.').setDMPermission(false), data: new SlashCommandBuilder().setName('status').setDescription('Show bot status.').setDMPermission(false),
execute: async ({ interaction, client }) => { execute: async ({ interaction, client }) => {
if (!systemServerGuildIds.includes(interaction.guildId)) { if (!systemOptions.systemGuildIds.includes(interaction.guildId)) {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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 cpuUsage = await osu.cpu.usage();
const cpuCores = await osu.cpu.count(); const cpuCores = await osu.cpu.count();
const platform = await osu.os.platform(); const platform = await osu.os.platform();
const releaseVersion = packageJson.version; const releaseVersion = version;
const discordJsVersion = packageJson.dependencies['discord.js']; const discordJsVersion = dependencies['discord.js'];
const discordPlayerVersion = packageJson.dependencies['discord-player']; const discordPlayerVersion = dependencies['discord-player'];
const discordApiLatency = client.ws.ping; const discordApiLatency = client.ws.ping;
let activeVoiceConnections = 0; let activeVoiceConnections = 0;
client.guilds.cache.forEach((guild) => { client.guilds.cache.forEach((guild) => {
@@ -49,7 +47,7 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .setDescription(
`**${embedIcons.bot} System and bot status**\n` + `**${embedOptions.icons.bot} System and bot status**\n` +
`Uptime: \`${uptimeString}\`\n` + `Uptime: \`${uptimeString}\`\n` +
`Platform: \`${platform}\`\n` + `Platform: \`${platform}\`\n` +
`CPU cores: \`${cpuCores}\`\n` + `CPU cores: \`${cpuCores}\`\n` +
@@ -65,7 +63,7 @@ module.exports = {
`Active voice connections: \`${activeVoiceConnections}\`\n` + `Active voice connections: \`${activeVoiceConnections}\`\n` +
`Joined guilds: \`${client.guilds.cache.size}\`` `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('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js'));
const { Events } = require('discord.js'); const { Events } = require('discord.js');
module.exports = { module.exports = {
+7 -8
View File
@@ -1,7 +1,6 @@
const path = require('node:path'); const logger = require('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js')); const { embedOptions, systemOptions } = require('../../config');
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const { systemMessageChannelId, systemUserId, embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
name: 'disconnect', name: 'disconnect',
@@ -11,15 +10,15 @@ module.exports = {
logger.warn(`${client.user.tag} lost connection to Discord APIs. Disconnected.`); logger.warn(`${client.user.tag} lost connection to Discord APIs. Disconnected.`);
// send message to system message channel for event // send message to system message channel for event
if (systemMessageChannelId && systemUserId) { if (systemOptions.systemMessageChannelId && systemOptions.systemUserId) {
await client.channels.cache.get(systemMessageChannelId).send({ await client.channels.cache.get(systemOptions.systemMessageChannelId).send({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .setDescription(
`${embedIcons.warning} **${client.user.tag}** is **\`disconnected\`**!` + `${embedOptions.icons.warning} **${client.user.tag}** is **\`disconnected\`**!` +
`\n<@${systemUserId}>` `\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('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js'));
const { Events } = require('discord.js'); const { Events } = require('discord.js');
module.exports = { module.exports = {
+1 -2
View File
@@ -1,5 +1,4 @@
const path = require('node:path'); const logger = require('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js'));
const { Events } = require('discord.js'); const { Events } = require('discord.js');
module.exports = { module.exports = {
+1 -2
View File
@@ -1,5 +1,4 @@
const path = require('node:path'); const logger = require('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js'));
const { Events } = require('discord.js'); const { Events } = require('discord.js');
module.exports = { module.exports = {
+7 -8
View File
@@ -1,8 +1,7 @@
const path = require('node:path'); const logger = require('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js')); const { embedOptions, systemOptions } = require('../../config');
const { Events, ActivityType, PresenceUpdateStatus, EmbedBuilder } = require('discord.js'); const { Events, ActivityType, PresenceUpdateStatus, EmbedBuilder } = require('discord.js');
const { postBotStats } = require(path.resolve('./src/utils/postBotStats.js')); const { postBotStats } = require('../../utils/postBotStats.js');
const { systemMessageChannelId, embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
name: Events.ClientReady, name: Events.ClientReady,
@@ -24,12 +23,12 @@ module.exports = {
process.env.NODE_ENV === 'production' ? postBotStats(client) : null; process.env.NODE_ENV === 'production' ? postBotStats(client) : null;
// send message to system message channel for event // send message to system message channel for event
if (systemMessageChannelId) { if (systemOptions.systemMessageChannelId) {
await client.channels.cache.get(systemMessageChannelId).send({ await client.channels.cache.get(systemOptions.systemMessageChannelId).send({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription(`${embedIcons.success} **${client.user.tag}** is now **\`online\`**!`) .setDescription(`${embedOptions.icons.success} **${client.user.tag}** is now **\`online\`**!`)
.setColor(embedColors.colorSuccess) .setColor(embedOptions.colors.success)
] ]
}); });
} }
+7 -8
View File
@@ -1,7 +1,6 @@
const path = require('node:path'); const logger = require('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js')); const { embedOptions, systemOptions } = require('../../config');
const { EmbedBuilder } = require('discord.js'); const { EmbedBuilder } = require('discord.js');
const { systemMessageChannelId, systemUserId, embedColors, embedIcons } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
name: 'reconnecting', name: 'reconnecting',
@@ -11,15 +10,15 @@ module.exports = {
logger.warn(`${client.user.tag} is reconnecting to Discord APIs.`); logger.warn(`${client.user.tag} is reconnecting to Discord APIs.`);
// send message to system message channel for event // send message to system message channel for event
if (systemMessageChannelId && systemUserId) { if (systemOptions.systemMessageChannelId && systemOptions.systemUserId) {
await client.channels.cache.get(systemMessageChannelId).send({ await client.channels.cache.get(systemOptions.systemMessageChannelId).send({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .setDescription(
`${embedIcons.warning} **${client.user.tag}** is **\`reconnecting\`**!` + `${embedOptions.icons.warning} **${client.user.tag}** is **\`reconnecting\`**!` +
`\n<@${systemUserId}>` `\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('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js'));
const { Events } = require('discord.js'); const { Events } = require('discord.js');
module.exports = { module.exports = {
+6 -7
View File
@@ -1,7 +1,6 @@
const path = require('node:path'); const logger = require('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js')); const { embedOptions, botOptions } = require('../../config');
const { Events, EmbedBuilder } = require('discord.js'); const { Events, EmbedBuilder } = require('discord.js');
const { embedColors, embedIcons, botInfo } = require(path.resolve('./config.json'));
module.exports = { module.exports = {
name: Events.InteractionCreate, name: Events.InteractionCreate,
@@ -46,11 +45,11 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .setDescription(
`**${embedIcons.warning} Warning**\nThis command took ${ `**${embedOptions.icons.warning} Warning**\nThis command took ${
executionTime / 1000 executionTime / 1000
} seconds to execute.\n\n_If you experienced problems with the command, please try again._` } seconds to execute.\n\n_If you experienced problems with the command, please try again._`
) )
.setColor(embedColors.colorWarning) .setColor(embedOptions.colors.warning)
] ]
}); });
} else { } else {
@@ -68,9 +67,9 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js'));
require('dotenv').config();
// Emitted when the player queue encounters error // Emitted when the player queue encounters error
module.exports = { module.exports = {
+1 -3
View File
@@ -1,6 +1,4 @@
const path = require('node:path'); const logger = require('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js'));
require('dotenv').config();
module.exports = { module.exports = {
name: 'debug', name: 'debug',
+1 -2
View File
@@ -1,5 +1,4 @@
const path = require('node:path'); const logger = require('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js'));
module.exports = { module.exports = {
name: 'error', name: 'error',
+1 -2
View File
@@ -1,5 +1,4 @@
const path = require('node:path'); const logger = require('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js'));
module.exports = { module.exports = {
name: 'error', name: 'error',
+1 -3
View File
@@ -1,6 +1,4 @@
const path = require('node:path'); const logger = require('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js'));
require('dotenv').config();
module.exports = { module.exports = {
name: 'playerSkip', name: 'playerSkip',
+1 -3
View File
@@ -1,6 +1,4 @@
const path = require('node:path'); const logger = require('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js'));
require('dotenv').config();
module.exports = { module.exports = {
name: 'playerStart', name: 'playerStart',
+1 -3
View File
@@ -1,6 +1,4 @@
const path = require('node:path'); const logger = require('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js'));
require('dotenv').config();
module.exports = { module.exports = {
name: 'uncaughtException', name: 'uncaughtException',
+1 -3
View File
@@ -1,6 +1,4 @@
const path = require('node:path'); const logger = require('../../services/logger');
const logger = require(path.resolve('./src/services/logger.js'));
require('dotenv').config();
module.exports = { module.exports = {
name: 'unhandledRejection', name: 'unhandledRejection',
+6 -9
View File
@@ -1,11 +1,10 @@
require('dotenv').config();
const fs = require('node:fs'); const fs = require('node:fs');
const path = require('node:path');
const Discord = require('discord.js'); 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 { Player, onBeforeCreateStream } = require('discord-player');
const { stream } = require('yt-stream'); const { stream } = require('yt-stream');
const { registerEventListeners } = require(path.resolve('./src/utils/registerEventListeners.js')); const { registerEventListeners } = require('./utils/registerEventListeners.js');
require('dotenv').config();
const client = new Discord.Client({ const client = new Discord.Client({
intents: [Discord.GatewayIntentBits.Guilds, Discord.GatewayIntentBits.GuildVoiceStates], intents: [Discord.GatewayIntentBits.Guilds, Discord.GatewayIntentBits.GuildVoiceStates],
@@ -62,14 +61,12 @@ onBeforeCreateStream(async (track) => {
}); });
client.commands = new Discord.Collection(); client.commands = new Discord.Collection();
const commandFolders = fs.readdirSync(path.resolve('./src/commands')); const commandFolders = fs.readdirSync('./src/commands');
for (const folder of commandFolders) { for (const folder of commandFolders) {
const commandFiles = fs const commandFiles = fs.readdirSync(`./src/commands/${folder}`).filter((file) => file.endsWith('.js'));
.readdirSync(path.resolve(`./src/commands/${folder}`))
.filter((file) => file.endsWith('.js'));
for (const file of commandFiles) { 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); client.commands.set(command.data.name, command);
} }
} }
+4 -4
View File
@@ -1,11 +1,11 @@
const pino = require('pino'); const pino = require('pino');
require('dotenv').config(); const { loggerOptions } = require('../config');
const transport = pino.transport({ const transport = pino.transport({
targets: [ targets: [
{ {
target: 'pino/file', target: 'pino/file',
level: process.env.MINIMUM_LOG_LEVEL, level: loggerOptions.minimumLogLevel,
options: { options: {
destination: './logs/app-all.log', destination: './logs/app-all.log',
mkdir: true, mkdir: true,
@@ -34,7 +34,7 @@ const transport = pino.transport({
}, },
{ {
target: 'pino/file', target: 'pino/file',
level: process.env.MINIMUM_LOG_LEVEL_CONSOLE, level: loggerOptions.minimumLogLevelConsole,
options: { options: {
colorize: true, colorize: true,
sync: false sync: false
@@ -45,7 +45,7 @@ const transport = pino.transport({
module.exports = pino( module.exports = pino(
{ {
level: process.env.MINIMUM_LOG_LEVEL, level: loggerOptions.minimumLogLevel,
timestamp: () => `,"timestamp":"${new Date(Date.now()).toISOString()}"`, timestamp: () => `,"timestamp":"${new Date(Date.now()).toISOString()}"`,
base: undefined 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(); 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 slashCommands = [];
const systemCommands = []; const systemCommands = [];
const commandFolders = fs.readdirSync(path.resolve('./src/commands')); const commandFolders = fs.readdirSync('./src/commands');
for (const folder of commandFolders) { for (const folder of commandFolders) {
const commandFiles = fs const commandFiles = fs.readdirSync(`./src/commands/${folder}`).filter((file) => file.endsWith('.js'));
.readdirSync(path.resolve(`./src/commands/${folder}`))
.filter((file) => file.endsWith('.js'));
for (const file of commandFiles) { for (const file of commandFiles) {
const command = require(path.resolve(`./src/commands/${folder}/${file}`)); const command = require(`../commands/${folder}/${file}`);
command.isSystemCommand command.isSystemCommand
? systemCommands.push(command.data.toJSON()) ? systemCommands.push(command.data.toJSON())
: slashCommands.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.'); 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 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.'); logger.info('Started refreshing application (/) system commands.');
for (const systemServerGuildId of systemServerGuildIds) { for (const systemGuildId of systemOptions.systemGuildIds) {
logger.info(`Refreshing system commands for guild id ${systemServerGuildId}.`); logger.info(`Refreshing system commands for guild id ${systemGuildId}.`);
await rest.put(Routes.applicationGuildCommands(process.env.DISCORD_CLIENT_ID, systemServerGuildId), { await rest.put(Routes.applicationGuildCommands(process.env.DISCORD_APPLICATION_ID, systemGuildId), {
body: systemCommands body: systemCommands
}); });
} }
+7 -9
View File
@@ -1,7 +1,5 @@
const path = require('node:path'); const logger = require('../services/logger');
const logger = require(path.resolve('./src/services/logger.js'));
const https = require('node:https'); const https = require('node:https');
require('dotenv').config();
exports.postBotStats = (client) => { exports.postBotStats = (client) => {
try { try {
@@ -11,42 +9,42 @@ exports.postBotStats = (client) => {
const sites = [ const sites = [
{ {
hostname: 'top.gg', hostname: 'top.gg',
path: `/api/bots/${process.env.DISCORD_CLIENT_ID}/stats`, path: `/api/bots/${process.env.DISCORD_APPLICATION_ID}/stats`,
method: 'POST', method: 'POST',
body: { server_count: guildCount }, body: { server_count: guildCount },
token: process.env.BOTLIST_TOP_GG_API_TOKEN token: process.env.BOTLIST_TOP_GG_API_TOKEN
}, },
{ {
hostname: 'discordbotlist.com', 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', method: 'POST',
body: { guilds: guildCount }, body: { guilds: guildCount },
token: process.env.BOTLIST_DISCORD_BOT_LIST_COM_API_TOKEN token: process.env.BOTLIST_DISCORD_BOT_LIST_COM_API_TOKEN
}, },
{ {
hostname: 'discords.com', hostname: 'discords.com',
path: `/bots/api/bot/${process.env.DISCORD_CLIENT_ID}`, path: `/bots/api/bot/${process.env.DISCORD_APPLICATION_ID}`,
method: 'POST', method: 'POST',
body: { server_count: guildCount }, body: { server_count: guildCount },
token: process.env.BOTLIST_DISCORDS_COM_API_TOKEN token: process.env.BOTLIST_DISCORDS_COM_API_TOKEN
}, },
{ {
hostname: 'discord.bots.gg', 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', method: 'POST',
body: { guildCount: guildCount }, body: { guildCount: guildCount },
token: process.env.BOTLIST_DISCORD_BOTS_GG_API_TOKEN token: process.env.BOTLIST_DISCORD_BOTS_GG_API_TOKEN
}, },
{ {
hostname: 'api.botlist.me', 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', method: 'POST',
body: { server_count: guildCount }, body: { server_count: guildCount },
token: process.env.BOTLIST_BOTLIST_ME_API_TOKEN token: process.env.BOTLIST_BOTLIST_ME_API_TOKEN
}, },
{ {
hostname: 'api.discordlist.gg', 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', method: 'PUT',
body: {}, body: {},
token: `Bearer ${process.env.BOTLIST_DISCORDLIST_GG_API_TOKEN}` 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 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) => { exports.registerEventListeners = (client, player) => {
const eventFolders = fs.readdirSync(path.resolve('./src/events')); const eventFolders = fs.readdirSync('./src/events');
for (const folder of eventFolders) { for (const folder of eventFolders) {
const eventFiles = fs const eventFiles = fs.readdirSync(`./src/events/${folder}`).filter((file) => file.endsWith('.js'));
.readdirSync(path.resolve(`./src/events/${folder}`))
.filter((file) => file.endsWith('.js'));
for (const file of eventFiles) { for (const file of eventFiles) {
const event = require(path.resolve(`./src/events/${folder}/${file}`)); const event = require(`../events/${folder}/${file}`);
switch (folder) { switch (folder) {
case 'client': case 'client':
if (event.once) { if (event.once) {