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