mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-03 23:36:35 +02:00
30 lines
989 B
JavaScript
30 lines
989 B
JavaScript
const { ButtonStyle, ButtonBuilder, ActionRowBuilder } = require('discord.js');
|
|
|
|
module.exports = {
|
|
name: 'ping',
|
|
description: 'Command to check the latency of the bot.',
|
|
async execute(message, args, client) {
|
|
const ping = new ButtonBuilder()
|
|
.setCustomId('confirm')
|
|
.setLabel('🔄')
|
|
.setStyle(ButtonStyle.Primary);
|
|
|
|
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 })
|
|
collector.on('collect', async (interaction) => {
|
|
sentMessage.edit({
|
|
content: `La latence est de : ${client.ws.ping}`,
|
|
components: [row],
|
|
});
|
|
interaction.reply({ content: 'La latence a été rafraichie', ephemeral: true });
|
|
});
|
|
},
|
|
}; |