diff --git a/commands/utils/christmas.js b/commands/utils/christmas.js index e879626..5399961 100644 --- a/commands/utils/christmas.js +++ b/commands/utils/christmas.js @@ -1,20 +1,44 @@ +const { EmbedBuilder, ButtonStyle, ButtonBuilder, ActionRowBuilder } = require('discord.js'); + module.exports = { - name: 'christmas', - description: 'Calcule le nombre de jours jusqu\'à Noël.', - emote: '🎄', - utilisation: 'christmas ', - category: 'game', + name: 'christmas', + aliases: ['noel', 'noël'], + description: 'Calcule le nombre de jours jusqu\'à Noël.', + emote: '🎄', + utilisation: 'christmas ', + category: 'game', - async execute(message, args, client) { - let today = new Date(); - let xmas = new Date(today.getFullYear(), 11, 24); - if (today.getMonth() == 11 && today.getDate() > 24) { - xmas.setFullYear(xmas.getFullYear() + 1); - } - let one_day = 1000 * 60 * 60 * 24; - let daysleft = Math.ceil((xmas.getTime() - today.getTime()) / (one_day)); - let days = daysleft + 1; + async execute(message, args, client) { + let today = new Date(); + let xmas = new Date(today.getFullYear(), 11, 24); + if (today.getMonth() == 11 && today.getDate() > 24) { + xmas.setFullYear(xmas.getFullYear() + 1); + } + let one_day = 1000 * 60 * 60 * 24; + let daysleft = Math.ceil((xmas.getTime() - today.getTime()) / (one_day)); + let days = daysleft + 1; - message.reply(`🎄・Noël\n${days} jours jusqu'à Noël`); - }, + const embed = new EmbedBuilder() + .setColor("#FF0000") + .setTitle("🎄・Noël") + .setDescription(`${days} jours jusqu'à Noël`) + .setTimestamp(); + + const button = new ButtonBuilder() + .setEmoji('🎁') + .setCustomId('gift') + .setStyle(ButtonStyle.Danger); + + const row = new ActionRowBuilder() + .addComponents(button); + + const messageGift = await message.reply({ embeds: [embed], components: [row]}); + + const filter = i => i.customId === 'gift' && i.user.id === message.author.id; + const collector = messageGift.createMessageComponentCollector({ filter, time: 300000 }); + collector.on('collect', async (interaction) => { + console.log('gift'); + interaction.reply({ content: `Joyeux Noël ${message.author} ! 🎁`, ephemeral: true }); + }); + }, }; \ No newline at end of file diff --git a/commands/utils/ping.js b/commands/utils/ping.js index 7b86ae3..593e17a 100644 --- a/commands/utils/ping.js +++ b/commands/utils/ping.js @@ -14,16 +14,16 @@ module.exports = { .setLabel('🔄') .setStyle(ButtonStyle.Primary); - const row = new ActionRowBuilder() + const row = new ActionRowBuilder() .addComponents(ping); + const sentMessage = await message.reply({ content: `la latence est de : ${client.ws.ping}`, components: [row], }); - const filter = i => i.customId === 'confirm' && i.user.id === message.author.id; - const collector = sentMessage.createMessageComponentCollector({ filter, time: 15000 }) + const collector = sentMessage.createMessageComponentCollector({ filter, time: 300000 }) collector.on('collect', async (interaction) => { sentMessage.edit({ content: `La latence est de : ${client.ws.ping}`,