mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-03 23:36:35 +02:00
noel
This commit is contained in:
+40
-16
@@ -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 });
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -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}`,
|
||||
|
||||
Reference in New Issue
Block a user