Files
ButlerBot/src/commands/utilities/countdown.js
2024-09-12 14:37:08 +00:00

21 lines
641 B
JavaScript

import { SlashCommandBuilder } from 'discord.js';
const data = new SlashCommandBuilder()
.setName('countdown')
.setDescription('Start a five second countdown.');
async function execute(interaction) {
await interaction.reply({ content: 'Starting countdown...' });
await new Promise((resolve) => setTimeout(resolve, 2000)); // 2-second delay
for (let i = 5; i > 0; i--) {
await interaction.editReply({ content: String(i) });
await new Promise((resolve) => setTimeout(resolve, 1000)); // 1-second delay between numbers
}
await interaction.editReply({ content: '🎉 GO! 🎉' });
}
export default { data, execute };