mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-02 14:38:49 +00:00
fix: Formatting
This commit is contained in:
1 parent
22f4a22c0e
commit
1d520e95bd
13 files changed
+91
-284
No files matched your search
@@ -8,12 +8,7 @@ const {
|
||||
ActionRowBuilder,
|
||||
ButtonBuilder
|
||||
} = require('discord.js');
|
||||
const {
|
||||
embedColors,
|
||||
embedIcons,
|
||||
filterList,
|
||||
filterThreadAmount
|
||||
} = require(path.resolve('./config.json'));
|
||||
const { embedColors, embedIcons, filterList, filterThreadAmount } = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -73,9 +68,7 @@ module.exports = {
|
||||
.setMaxValues(filterOptions.length)
|
||||
.addOptions(filterOptions);
|
||||
|
||||
const filterActionRow = new ActionRowBuilder().addComponents(
|
||||
filterSelect
|
||||
);
|
||||
const filterActionRow = new ActionRowBuilder().addComponents(filterSelect);
|
||||
|
||||
const disableFiltersActionRow = new ActionRowBuilder().addComponents(
|
||||
new ButtonBuilder()
|
||||
@@ -122,17 +115,12 @@ module.exports = {
|
||||
queue.filters.ffmpeg.setFilters(false);
|
||||
}
|
||||
|
||||
if (
|
||||
confirmation.customId === 'disable-filters' ||
|
||||
confirmation.values.length === 0
|
||||
) {
|
||||
if (confirmation.customId === 'disable-filters' || confirmation.values.length === 0) {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
@@ -151,24 +139,12 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
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
|
||||
}\``
|
||||
)
|
||||
`**${embedIcons.success} Filters toggled**\nNow using these filters:\n${confirmation.values
|
||||
.map((enabled) => `\`${filterList.find((filter) => enabled == filter.value).label}\``)
|
||||
.join(', ')}.`
|
||||
)
|
||||
.setColor(embedColors.colorSuccess)
|
||||
|
||||
@@ -7,9 +7,7 @@ const { embedColors, embedIcons } = require(path.resolve('./config.json'));
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('leave')
|
||||
.setDescription(
|
||||
'Clear the track queue and remove the bot from voice channel.'
|
||||
)
|
||||
.setDescription('Clear the track queue and remove the bot from voice channel.')
|
||||
.setDMPermission(false),
|
||||
|
||||
// todo, allow command to be executed if bot is only member in voice channel
|
||||
@@ -47,9 +45,7 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
|
||||
@@ -66,9 +66,7 @@ module.exports = {
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`**${
|
||||
currentMode === 3
|
||||
? embedIcons.autoplay
|
||||
: embedIcons.loop
|
||||
currentMode === 3 ? embedIcons.autoplay : embedIcons.loop
|
||||
} Current loop mode**\nThe looping mode is currently set to \`${currentModeUserString}\`.`
|
||||
)
|
||||
.setColor(embedColors.colorInfo)
|
||||
@@ -80,9 +78,7 @@ module.exports = {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`**${embedIcons.warning} Oops!**\nLoop mode is already \`${modeUserString}\`.`
|
||||
)
|
||||
.setDescription(`**${embedIcons.warning} Oops!**\nLoop mode is already \`${modeUserString}\`.`)
|
||||
.setColor(embedColors.colorWarning)
|
||||
]
|
||||
});
|
||||
@@ -107,9 +103,7 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
@@ -125,9 +119,7 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
@@ -142,9 +134,7 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
|
||||
@@ -2,11 +2,7 @@ const path = require('node:path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useQueue } = require('discord-player');
|
||||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');
|
||||
const {
|
||||
embedColors,
|
||||
embedIcons,
|
||||
progressBarOptions
|
||||
} = require(path.resolve('./config.json'));
|
||||
const { embedColors, embedIcons, progressBarOptions } = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -87,14 +83,10 @@ module.exports = {
|
||||
plays = 'Unavailable';
|
||||
}
|
||||
|
||||
const source =
|
||||
sourceStringsFormatted.get(currentTrack.raw.source) ??
|
||||
'Unavailable';
|
||||
const source = sourceStringsFormatted.get(currentTrack.raw.source) ?? 'Unavailable';
|
||||
const queueLength = queue.tracks.data.length;
|
||||
const timestamp = queue.node.getTimestamp();
|
||||
let bar = `**\`${
|
||||
timestamp.current.label
|
||||
}\`** ${queue.node.createProgressBar({
|
||||
let bar = `**\`${timestamp.current.label}\`** ${queue.node.createProgressBar({
|
||||
queue: false,
|
||||
length: progressBarOptions.length ?? 12,
|
||||
timecodes: progressBarOptions.timecodes ?? false,
|
||||
@@ -103,10 +95,7 @@ module.exports = {
|
||||
rightChar: progressBarOptions.rightChar ?? '▬'
|
||||
})} **\`${timestamp.total.label}\`**`;
|
||||
|
||||
if (
|
||||
currentTrack.raw.duration === 0 ||
|
||||
currentTrack.duration === '0:00'
|
||||
) {
|
||||
if (currentTrack.raw.duration === 0 || currentTrack.duration === '0:00') {
|
||||
bar = 'No duration available.';
|
||||
}
|
||||
|
||||
@@ -131,9 +120,7 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: `Channel: ${queue.channel.name} (${
|
||||
queue.channel.bitrate / 1000
|
||||
}kbps)`,
|
||||
name: `Channel: ${queue.channel.name} (${queue.channel.bitrate / 1000}kbps)`,
|
||||
iconURL: interaction.guild.iconURL()
|
||||
})
|
||||
.setDescription(
|
||||
@@ -147,9 +134,7 @@ module.exports = {
|
||||
queue.repeatMode === 0
|
||||
? ''
|
||||
: `**${
|
||||
queue.repeatMode === 3
|
||||
? embedIcons.autoplay
|
||||
: embedIcons.loop
|
||||
queue.repeatMode === 3 ? embedIcons.autoplay : embedIcons.loop
|
||||
} Looping**\nLoop mode is set to ${loopModeUserString}. You can change it with **\`/loop\`**.`
|
||||
}`
|
||||
)
|
||||
@@ -166,16 +151,12 @@ module.exports = {
|
||||
},
|
||||
{
|
||||
name: '**Audio source**',
|
||||
value: `**${sourceIcons.get(
|
||||
currentTrack.raw.source
|
||||
)} [${source}](${currentTrack.url})**`,
|
||||
value: `**${sourceIcons.get(currentTrack.raw.source)} [${source}](${currentTrack.url})**`,
|
||||
inline: true
|
||||
}
|
||||
)
|
||||
.setFooter({
|
||||
text: queueLength
|
||||
? `${queueLength} other tracks in the queue...`
|
||||
: ' '
|
||||
text: queueLength ? `${queueLength} other tracks in the queue...` : ' '
|
||||
})
|
||||
.setThumbnail(queue.currentTrack.thumbnail)
|
||||
.setColor(embedColors.colorInfo)
|
||||
@@ -193,10 +174,7 @@ module.exports = {
|
||||
confirmation.deferUpdate();
|
||||
|
||||
if (confirmation.customId === 'nowplaying-skip') {
|
||||
if (
|
||||
!queue ||
|
||||
(queue.tracks.data.length === 0 && !queue.currentTrack)
|
||||
) {
|
||||
if (!queue || (queue.tracks.data.length === 0 && !queue.currentTrack)) {
|
||||
return await interaction.followUp({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
@@ -224,23 +202,18 @@ module.exports = {
|
||||
|
||||
const skippedTrack = queue.currentTrack;
|
||||
let durationFormat =
|
||||
skippedTrack.raw.duration === 0 ||
|
||||
skippedTrack.duration === '0:00'
|
||||
skippedTrack.raw.duration === 0 || skippedTrack.duration === '0:00'
|
||||
? ''
|
||||
: `\`${skippedTrack.duration}\``;
|
||||
queue.node.skip();
|
||||
|
||||
const repeatModeUserString = loopModesFormatted.get(
|
||||
queue.repeatMode
|
||||
);
|
||||
const repeatModeUserString = loopModesFormatted.get(queue.repeatMode);
|
||||
|
||||
return await interaction.followUp({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
@@ -249,9 +222,7 @@ module.exports = {
|
||||
queue.repeatMode === 0
|
||||
? ''
|
||||
: `\n\n**${
|
||||
queue.repeatMode === 3
|
||||
? embedIcons.autoplaying
|
||||
: embedIcons.looping
|
||||
queue.repeatMode === 3 ? embedIcons.autoplaying : embedIcons.looping
|
||||
} Looping**\nLoop mode is set to ${repeatModeUserString}. You can change it with **\`/loop\`**.`
|
||||
}`
|
||||
)
|
||||
|
||||
@@ -49,8 +49,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
let durationFormat =
|
||||
queue.currentTrack.raw.duration === 0 ||
|
||||
queue.currentTrack.duration === '0:00'
|
||||
queue.currentTrack.raw.duration === 0 || queue.currentTrack.duration === '0:00'
|
||||
? ''
|
||||
: `\`${queue.currentTrack.duration}\``;
|
||||
|
||||
@@ -61,19 +60,13 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
`**${embedIcons.pauseResumed} ${
|
||||
queue.node.isPaused()
|
||||
? 'Paused Track'
|
||||
: 'Resumed track'
|
||||
}**\n**${durationFormat} [${
|
||||
queue.currentTrack.title
|
||||
}](${queue.currentTrack.url})**`
|
||||
queue.node.isPaused() ? 'Paused Track' : 'Resumed track'
|
||||
}**\n**${durationFormat} [${queue.currentTrack.title}](${queue.currentTrack.url})**`
|
||||
)
|
||||
.setThumbnail(queue.currentTrack.thumbnail)
|
||||
.setColor(embedColors.colorSuccess)
|
||||
|
||||
+26
-62
@@ -2,26 +2,14 @@ const path = require('node:path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useMainPlayer, useQueue } = require('discord-player');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const {
|
||||
embedColors,
|
||||
embedIcons,
|
||||
playerOptions,
|
||||
botInfo
|
||||
} = require(path.resolve('./config.json'));
|
||||
const { embedColors, embedIcons, playerOptions, botInfo } = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('play')
|
||||
.setDescription(
|
||||
'Add a track or playlist to the queue by searching or url.'
|
||||
)
|
||||
.setDescription('Add a track or playlist to the queue by searching or url.')
|
||||
.setDMPermission(false)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('query')
|
||||
.setDescription('Search query or URL.')
|
||||
.setRequired(true)
|
||||
),
|
||||
.addStringOption((option) => option.setName('query').setDescription('Search query or URL.').setRequired(true)),
|
||||
run: async ({ interaction }) => {
|
||||
if (!interaction.member.voice.channel) {
|
||||
return await interaction.editReply({
|
||||
@@ -73,27 +61,20 @@ module.exports = {
|
||||
let track;
|
||||
|
||||
try {
|
||||
({ track } = await player.play(
|
||||
interaction.member.voice.channel,
|
||||
searchResult,
|
||||
{
|
||||
requestedBy: interaction.user,
|
||||
nodeOptions: {
|
||||
leaveOnEmpty: playerOptions.leaveOnEmpty ?? true,
|
||||
leaveOnEmptyCooldown:
|
||||
playerOptions.leaveOnEmptyCooldown ?? 60000,
|
||||
leaveOnEnd: playerOptions.leaveOnEnd ?? true,
|
||||
leaveOnEndCooldown:
|
||||
playerOptions.leaveOnEndCooldown ?? 60000,
|
||||
leaveOnStop: playerOptions.leaveOnStop ?? true,
|
||||
leaveOnStopCooldown:
|
||||
playerOptions.leaveOnStopCooldown ?? 60000,
|
||||
maxSize: playerOptions.maxQueueSize ?? 1000,
|
||||
maxHistorySize: playerOptions.maxHistorySize ?? 100,
|
||||
volume: playerOptions.defaultVolume ?? 50
|
||||
}
|
||||
({ track } = await player.play(interaction.member.voice.channel, searchResult, {
|
||||
requestedBy: interaction.user,
|
||||
nodeOptions: {
|
||||
leaveOnEmpty: playerOptions.leaveOnEmpty ?? true,
|
||||
leaveOnEmptyCooldown: playerOptions.leaveOnEmptyCooldown ?? 60000,
|
||||
leaveOnEnd: playerOptions.leaveOnEnd ?? true,
|
||||
leaveOnEndCooldown: playerOptions.leaveOnEndCooldown ?? 60000,
|
||||
leaveOnStop: playerOptions.leaveOnStop ?? true,
|
||||
leaveOnStopCooldown: playerOptions.leaveOnStopCooldown ?? 60000,
|
||||
maxSize: playerOptions.maxQueueSize ?? 1000,
|
||||
maxHistorySize: playerOptions.maxHistorySize ?? 100,
|
||||
volume: playerOptions.defaultVolume ?? 50
|
||||
}
|
||||
));
|
||||
}));
|
||||
} catch (error) {
|
||||
if (error.message.includes('Sign in to confirm your age')) {
|
||||
return await interaction.editReply({
|
||||
@@ -109,15 +90,9 @@ module.exports = {
|
||||
|
||||
if (
|
||||
(error.type === 'TypeError' &&
|
||||
(error.message.includes(
|
||||
'Cannot read properties of null (reading \'createStream\')'
|
||||
) ||
|
||||
error.message.includes(
|
||||
'Failed to fetch resources for ytdl streaming'
|
||||
))) ||
|
||||
error.message.includes(
|
||||
'Could not extract stream for this track'
|
||||
)
|
||||
(error.message.includes('Cannot read properties of null (reading \'createStream\')') ||
|
||||
error.message.includes('Failed to fetch resources for ytdl streaming'))) ||
|
||||
error.message.includes('Could not extract stream for this track')
|
||||
) {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
@@ -162,27 +137,20 @@ module.exports = {
|
||||
'https://raw.githubusercontent.com/mariusbegby/cadence-discord-bot/main/assets/logo-rounded-128px.png';
|
||||
}
|
||||
|
||||
let durationFormat =
|
||||
track.raw.duration === 0 || track.duration === '0:00'
|
||||
? ''
|
||||
: `\`${track.duration}\``;
|
||||
let durationFormat = track.raw.duration === 0 || track.duration === '0:00' ? '' : `\`${track.duration}\``;
|
||||
|
||||
if (searchResult.playlist && searchResult.tracks.length > 1) {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
`**${
|
||||
embedIcons.success
|
||||
} Added playlist to queue**\n**${durationFormat} [${
|
||||
track.title
|
||||
}](${track.url})**\n\nAnd **${
|
||||
`**${embedIcons.success} Added playlist to queue**\n**${durationFormat} [${track.title}](${
|
||||
track.url
|
||||
})**\n\nAnd **${
|
||||
searchResult.tracks.length - 1
|
||||
}** more tracks... **\`/queue\`** to view all.`
|
||||
)
|
||||
@@ -198,9 +166,7 @@ module.exports = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
interaction.member.nickname || interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
@@ -216,9 +182,7 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
|
||||
@@ -2,23 +2,14 @@ const path = require('node:path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { useQueue } = require('discord-player');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const {
|
||||
embedColors,
|
||||
embedIcons,
|
||||
progressBarOptions
|
||||
} = require(path.resolve('./config.json'));
|
||||
const { embedColors, embedIcons, progressBarOptions } = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('queue')
|
||||
.setDescription('Show the list of tracks added to the queue.')
|
||||
.setDMPermission(false)
|
||||
.addNumberOption((option) =>
|
||||
option
|
||||
.setName('page')
|
||||
.setDescription('Page number of the queue')
|
||||
.setMinValue(1)
|
||||
),
|
||||
.addNumberOption((option) => option.setName('page').setDescription('Page number of the queue').setMinValue(1)),
|
||||
run: async ({ interaction }) => {
|
||||
if (!interaction.member.voice.channel) {
|
||||
return await interaction.editReply({
|
||||
@@ -59,9 +50,7 @@ module.exports = {
|
||||
name: interaction.guild.name,
|
||||
iconURL: interaction.guild.iconURL()
|
||||
})
|
||||
.setDescription(
|
||||
`**${embedIcons.queue} Tracks in queue**\n${queueString}`
|
||||
)
|
||||
.setDescription(`**${embedIcons.queue} Tracks in queue**\n${queueString}`)
|
||||
.setColor(embedColors.colorInfo)
|
||||
.setFooter({
|
||||
text: 'Page 1 of 1'
|
||||
@@ -93,13 +82,9 @@ module.exports = {
|
||||
.slice(pageIndex * 10, pageIndex * 10 + 10)
|
||||
.map((track, index) => {
|
||||
let durationFormat =
|
||||
track.raw.duration === 0 || track.duration === '0:00'
|
||||
? ''
|
||||
: `\`${track.duration}\``;
|
||||
track.raw.duration === 0 || track.duration === '0:00' ? '' : `\`${track.duration}\``;
|
||||
|
||||
return `**${
|
||||
pageIndex * 10 + index + 1
|
||||
}.** **${durationFormat} [${track.title}](${track.url})**`;
|
||||
return `**${pageIndex * 10 + index + 1}.** **${durationFormat} [${track.title}](${track.url})**`;
|
||||
})
|
||||
.join('\n');
|
||||
}
|
||||
@@ -119,9 +104,7 @@ module.exports = {
|
||||
queue.repeatMode === 0
|
||||
? ''
|
||||
: `**${
|
||||
queue.repeatMode === 3
|
||||
? embedIcons.autoplay
|
||||
: embedIcons.loop
|
||||
queue.repeatMode === 3 ? embedIcons.autoplay : embedIcons.loop
|
||||
} Looping**\nLoop mode is set to ${loopModeUserString}. You can change it with **\`/loop\`**.\n\n`
|
||||
}`;
|
||||
|
||||
@@ -130,14 +113,11 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: `Channel: ${queue.channel.name} (${
|
||||
queue.channel.bitrate / 1000
|
||||
}kbps)`,
|
||||
name: `Channel: ${queue.channel.name} (${queue.channel.bitrate / 1000}kbps)`,
|
||||
iconURL: interaction.guild.iconURL()
|
||||
})
|
||||
.setDescription(
|
||||
`${repeatModeString}` +
|
||||
`**${embedIcons.queue} Tracks in queue**\n${queueString}`
|
||||
`${repeatModeString}` + `**${embedIcons.queue} Tracks in queue**\n${queueString}`
|
||||
)
|
||||
.setFooter({
|
||||
text: `Page ${pageIndex + 1} of ${totalPages}`
|
||||
@@ -147,9 +127,7 @@ module.exports = {
|
||||
});
|
||||
} else {
|
||||
const timestamp = queue.node.getTimestamp();
|
||||
let bar = `**\`${
|
||||
timestamp.current.label
|
||||
}\`** ${queue.node.createProgressBar({
|
||||
let bar = `**\`${timestamp.current.label}\`** ${queue.node.createProgressBar({
|
||||
queue: false,
|
||||
length: progressBarOptions.length ?? 12,
|
||||
timecodes: progressBarOptions.timecodes ?? false,
|
||||
@@ -158,10 +136,7 @@ module.exports = {
|
||||
rightChar: progressBarOptions.rightChar ?? '▬'
|
||||
})} **\`${timestamp.total.label}\`**`;
|
||||
|
||||
if (
|
||||
currentTrack.raw.duration === 0 ||
|
||||
currentTrack.duration === '0:00'
|
||||
) {
|
||||
if (currentTrack.raw.duration === 0 || currentTrack.duration === '0:00') {
|
||||
bar = '_No duration available._';
|
||||
}
|
||||
|
||||
@@ -169,16 +144,12 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: `Channel: ${queue.channel.name} (${
|
||||
queue.channel.bitrate / 1000
|
||||
}kbps)`,
|
||||
name: `Channel: ${queue.channel.name} (${queue.channel.bitrate / 1000}kbps)`,
|
||||
iconURL: interaction.guild.iconURL()
|
||||
})
|
||||
.setDescription(
|
||||
`**${embedIcons.audioPlaying} Now playing**\n` +
|
||||
(currentTrack
|
||||
? `**[${currentTrack.title}](${currentTrack.url})**`
|
||||
: 'None') +
|
||||
(currentTrack ? `**[${currentTrack.title}](${currentTrack.url})**` : 'None') +
|
||||
`\nRequested by: <@${currentTrack.requestedBy.id}>` +
|
||||
`\n ${bar}\n\n` +
|
||||
`${repeatModeString}` +
|
||||
|
||||
@@ -60,17 +60,13 @@ module.exports = {
|
||||
// Remove specified track number from queue
|
||||
const removedTrack = queue.node.remove(removeTrackNumber - 1);
|
||||
let durationFormat =
|
||||
removedTrack.raw.duration === 0 || removedTrack.duration === '0:00'
|
||||
? ''
|
||||
: `\`${removedTrack.duration}\``;
|
||||
removedTrack.raw.duration === 0 || removedTrack.duration === '0:00' ? '' : `\`${removedTrack.duration}\``;
|
||||
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
|
||||
@@ -12,9 +12,7 @@ module.exports = {
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('duration')
|
||||
.setDescription(
|
||||
'Duration in format 00:00:00 (HH:mm:ss) to seek to.'
|
||||
)
|
||||
.setDescription('Duration in format 00:00:00 (HH:mm:ss) to seek to.')
|
||||
.setRequired(true)
|
||||
),
|
||||
run: async ({ interaction }) => {
|
||||
@@ -131,10 +129,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
const currentTrackMaxDurationInMs = queue.currentTrack.durationMS;
|
||||
const durationInMilliseconds =
|
||||
durationArray[0] * 3600000 +
|
||||
durationArray[1] * 60000 +
|
||||
durationArray[2] * 1000;
|
||||
const durationInMilliseconds = durationArray[0] * 3600000 + durationArray[1] * 60000 + durationArray[2] * 1000;
|
||||
|
||||
if (durationInMilliseconds > currentTrackMaxDurationInMs - 1000) {
|
||||
return await interaction.editReply({
|
||||
@@ -153,9 +148,7 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
|
||||
@@ -10,10 +10,7 @@ module.exports = {
|
||||
.setDescription('Skip current or specified track.')
|
||||
.setDMPermission(false)
|
||||
.addNumberOption((option) =>
|
||||
option
|
||||
.setName('tracknumber')
|
||||
.setDescription('Track number to skip to in the queue.')
|
||||
.setMinValue(1)
|
||||
option.setName('tracknumber').setDescription('Track number to skip to in the queue.').setMinValue(1)
|
||||
),
|
||||
run: async ({ interaction }) => {
|
||||
if (!interaction.member.voice.channel) {
|
||||
@@ -58,8 +55,7 @@ module.exports = {
|
||||
} else {
|
||||
const skippedTrack = queue.currentTrack;
|
||||
let durationFormat =
|
||||
skippedTrack.raw.duration === 0 ||
|
||||
skippedTrack.duration === '0:00'
|
||||
skippedTrack.raw.duration === 0 || skippedTrack.duration === '0:00'
|
||||
? ''
|
||||
: `\`${skippedTrack.duration}\``;
|
||||
queue.node.skipTo(skipToTrack - 1);
|
||||
@@ -68,9 +64,7 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
@@ -96,8 +90,7 @@ module.exports = {
|
||||
|
||||
const skippedTrack = queue.currentTrack;
|
||||
let durationFormat =
|
||||
skippedTrack.raw.duration === 0 ||
|
||||
skippedTrack.duration === '0:00'
|
||||
skippedTrack.raw.duration === 0 || skippedTrack.duration === '0:00'
|
||||
? ''
|
||||
: `\`${skippedTrack.duration}\``;
|
||||
queue.node.skip();
|
||||
@@ -115,9 +108,7 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
@@ -126,9 +117,7 @@ module.exports = {
|
||||
queue.repeatMode === 0
|
||||
? ''
|
||||
: `\n\n**${
|
||||
queue.repeatMode === 3
|
||||
? embedIcons.autoplaying
|
||||
: embedIcons.looping
|
||||
queue.repeatMode === 3 ? embedIcons.autoplaying : embedIcons.looping
|
||||
} Looping**\nLoop mode is set to ${loopModeUserString}. You can change it with **\`/loop\`**.`
|
||||
}`
|
||||
)
|
||||
|
||||
@@ -53,9 +53,7 @@ module.exports = {
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`**${
|
||||
currentVolume === 0
|
||||
? embedIcons.volumeIsMuted
|
||||
: embedIcons.volume
|
||||
currentVolume === 0 ? embedIcons.volumeIsMuted : embedIcons.volume
|
||||
} Playback volume**\nThe playback volume is currently set to \`${currentVolume}%\`.`
|
||||
)
|
||||
.setColor(embedColors.colorInfo)
|
||||
@@ -79,9 +77,7 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
@@ -96,9 +92,7 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name:
|
||||
interaction.member.nickname ||
|
||||
interaction.user.username,
|
||||
name: interaction.member.nickname || interaction.user.username,
|
||||
iconURL: interaction.user.avatarURL()
|
||||
})
|
||||
.setDescription(
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
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 { embedColors, embedIcons, systemServerGuildIds } = require(path.resolve('./config.json'));
|
||||
|
||||
module.exports = {
|
||||
isSystemCommand: true,
|
||||
@@ -35,16 +31,11 @@ module.exports = {
|
||||
})
|
||||
.sort((a, b) => b.memberCount - a.memberCount)
|
||||
.slice(0, 50)
|
||||
.map(
|
||||
(guild, index) =>
|
||||
`${index + 1}. \`${guild.name} (#${guild.memberCount})\``
|
||||
)
|
||||
.map((guild, index) => `${index + 1}. \`${guild.name} (#${guild.memberCount})\``)
|
||||
.join('\n');
|
||||
|
||||
let embedDescription = `**${embedIcons.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}`;
|
||||
|
||||
if (embedDescription.length >= 4000) {
|
||||
@@ -52,11 +43,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(embedDescription)
|
||||
.setColor(embedColors.colorInfo)
|
||||
]
|
||||
embeds: [new EmbedBuilder().setDescription(embedDescription).setColor(embedColors.colorInfo)]
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -2,20 +2,13 @@ const path = require('node:path');
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { useQueue } = require('discord-player');
|
||||
const {
|
||||
embedColors,
|
||||
embedIcons,
|
||||
systemServerGuildIds
|
||||
} = require(path.resolve('./config.json'));
|
||||
const { embedColors, embedIcons, systemServerGuildIds } = require(path.resolve('./config.json'));
|
||||
const osu = require('node-os-utils');
|
||||
const packageJson = require(path.resolve('./package.json'));
|
||||
|
||||
module.exports = {
|
||||
isSystemCommand: true,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('status')
|
||||
.setDescription('Show bot status.')
|
||||
.setDMPermission(false),
|
||||
data: new SlashCommandBuilder().setName('status').setDescription('Show bot status.').setDMPermission(false),
|
||||
run: async ({ interaction, client }) => {
|
||||
if (!systemServerGuildIds.includes(interaction.guildId)) {
|
||||
return await interaction.editReply({
|
||||
@@ -34,14 +27,8 @@ module.exports = {
|
||||
let uptimeDate = new Date(0);
|
||||
uptimeDate.setSeconds(uptimeInSeconds.toFixed(0));
|
||||
const uptimeString = uptimeDate.toISOString().substring(11, 19);
|
||||
const nodeProcessMemUsageInMb = (
|
||||
process.memoryUsage().heapUsed /
|
||||
1024 /
|
||||
1024
|
||||
).toFixed(2);
|
||||
const usedMemoryInMB = Math.ceil(
|
||||
(await osu.mem.info()).usedMemMb
|
||||
).toLocaleString('en-US');
|
||||
const nodeProcessMemUsageInMb = (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2);
|
||||
const usedMemoryInMB = Math.ceil((await osu.mem.info()).usedMemMb).toLocaleString('en-US');
|
||||
const cpuUsage = await osu.cpu.usage();
|
||||
const cpuCores = await osu.cpu.count();
|
||||
const platform = await osu.os.platform();
|
||||
|
||||
Reference in new issue
Block a user