mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 22:15:37 +00:00
organize command files into one folder
This commit is contained in:
1 parent
e85cd4dfc2
commit
676c915e6e
26 files changed
+158
-168
No files matched your search
@@ -0,0 +1,86 @@
|
||||
// @ts-ignore
|
||||
import { dependencies, version } from '../../../package.json';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
||||
import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../common/statusUtils';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||
import { checkValidGuildId } from '../../utils/validation/systemCommandValidator';
|
||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||
|
||||
class SystemStatusCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = localizeCommand(new SlashCommandBuilder().setName('systemstatus'));
|
||||
const isSystemCommand: boolean = true;
|
||||
super(data, isSystemCommand);
|
||||
}
|
||||
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction, client } = params;
|
||||
const logger = this.getLogger(this.name, executionId, interaction);
|
||||
const translator = useServerTranslator(interaction);
|
||||
|
||||
await this.runValidators({ interaction, executionId }, [checkValidGuildId]);
|
||||
|
||||
const [botStatisticsEmbedString, playerStatisticsEmbedString, systemStatusEmbedString] = await Promise.all([
|
||||
getBotStatistics(client!, version, translator),
|
||||
getPlayerStatistics(client!, translator),
|
||||
getSystemStatus(executionId, false, translator)
|
||||
]);
|
||||
const discordStatusEmbedString = getDiscordStatus(client!, translator);
|
||||
const dependenciesEmbedString = this.getDependencies();
|
||||
|
||||
logger.debug('Responding with info embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
translator('statistics.botStatus.title', { icon: this.embedOptions.icons.bot }) +
|
||||
'\n' +
|
||||
botStatisticsEmbedString
|
||||
)
|
||||
.addFields(
|
||||
{
|
||||
name: translator('statistics.queueStatus.title', {
|
||||
icon: this.embedOptions.icons.queue
|
||||
}),
|
||||
value: playerStatisticsEmbedString
|
||||
},
|
||||
{
|
||||
name: translator('statistics.systemStatus.title', {
|
||||
icon: this.embedOptions.icons.server
|
||||
}),
|
||||
value: systemStatusEmbedString
|
||||
},
|
||||
{
|
||||
name: translator('statistics.discordStatus.title', {
|
||||
icon: this.embedOptions.icons.discord
|
||||
}),
|
||||
value: discordStatusEmbedString
|
||||
},
|
||||
{
|
||||
name: translator('statistics.dependencies.title', {
|
||||
icon: this.embedOptions.icons.bot
|
||||
}),
|
||||
value: dependenciesEmbedString
|
||||
}
|
||||
)
|
||||
.setColor(this.embedOptions.colors.info)
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
private getDependencies(): string {
|
||||
return (
|
||||
`**${dependencies['discord.js']}** discord.js\n` +
|
||||
`**┗ ${dependencies['@discordjs/rest']}** @discordjs/rest\n` +
|
||||
`**${dependencies['discord-player']}** discord-player\n` +
|
||||
`**┗ ${dependencies['@discord-player/opus']}** @discord-player/opus\n` +
|
||||
`**┗ ${dependencies['@discord-player/extractor']}** @discord-player/extractor\n` +
|
||||
`**${dependencies['discord-voip']}** discord-voip\n` +
|
||||
`**${dependencies['mediaplex']}** mediaplex\n` +
|
||||
`**${dependencies['youtube-ext']}** youtube-ext`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default new SystemStatusCommand();
|
||||
Reference in new issue
Block a user