Initial commit
This commit is contained in:
24
src/commands/utilities/countdown.js
Normal file
24
src/commands/utilities/countdown.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('countdown')
|
||||
.setDescription('Start a five second countdown.');
|
||||
|
||||
async function execute(interaction) {
|
||||
// Initial response to acknowledge the command
|
||||
await interaction.reply({ content: 'Starting countdown...' });
|
||||
|
||||
// Initial delay before starting the countdown
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000)); // 2-second delay
|
||||
|
||||
// Edit the response with the countdown
|
||||
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
|
||||
}
|
||||
|
||||
// Final message
|
||||
await interaction.editReply({ content: '🎉 GO! 🎉' });
|
||||
}
|
||||
|
||||
export default { data, execute };
|
||||
Reference in New Issue
Block a user