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,52 @@
|
||||
import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../types/interactionTypes';
|
||||
import { checkQueueExists } from '../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||
import { localizeCommand, useServerTranslator } from '../../common/localeUtil';
|
||||
import { formatSlashCommand } from '../../common/formattingUtils';
|
||||
|
||||
class StopCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = localizeCommand(new SlashCommandBuilder().setName('stop'));
|
||||
super(data);
|
||||
}
|
||||
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.name, executionId, interaction);
|
||||
const translator = useServerTranslator(interaction);
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
await this.runValidators({ interaction, queue, executionId }, [
|
||||
checkInVoiceChannel,
|
||||
checkSameVoiceChannel,
|
||||
checkQueueExists
|
||||
]);
|
||||
|
||||
if (!queue.deleted) {
|
||||
queue.setRepeatMode(QueueRepeatMode.OFF);
|
||||
queue.node.stop();
|
||||
logger.debug('Cleared and stopped the queue.');
|
||||
}
|
||||
|
||||
logger.debug('Responding with success embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor(this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
translator('commands.stop.stoppedPlaying', {
|
||||
icon: this.embedOptions.icons.success,
|
||||
playCommand: formatSlashCommand('play', translator)
|
||||
})
|
||||
)
|
||||
.setColor(this.embedOptions.colors.success)
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default new StopCommand();
|
||||
Reference in new issue
Block a user