2023-10-13 15:04:11 +02:00
|
|
|
|
import {
|
|
|
|
|
SlashCommandBuilder,
|
|
|
|
|
ActionRowBuilder,
|
|
|
|
|
EmbedBuilder,
|
|
|
|
|
ButtonBuilder,
|
|
|
|
|
ButtonStyle,
|
|
|
|
|
} from "discord.js";
|
2023-09-13 21:12:45 +02:00
|
|
|
|
export default {
|
2023-10-13 15:04:11 +02:00
|
|
|
|
data: new SlashCommandBuilder()
|
|
|
|
|
.setName("ping")
|
|
|
|
|
.setDescription("Obtenir la latence du bot."),
|
2022-11-09 14:44:05 +01:00
|
|
|
|
|
2023-10-13 15:04:11 +02:00
|
|
|
|
async execute(interaction, client) {
|
|
|
|
|
const pingRefreshButton = new ButtonBuilder()
|
|
|
|
|
.setCustomId("pingrefreshbtn")
|
|
|
|
|
.setEmoji("🔁")
|
|
|
|
|
.setStyle(ButtonStyle.Primary);
|
2022-11-09 14:44:05 +01:00
|
|
|
|
|
2023-10-13 15:04:11 +02:00
|
|
|
|
const row = new ActionRowBuilder().addComponents([pingRefreshButton]);
|
2022-11-09 14:44:05 +01:00
|
|
|
|
|
2023-10-13 15:04:11 +02:00
|
|
|
|
const sent = await interaction.reply({
|
|
|
|
|
content: "Pinging...",
|
|
|
|
|
components: [row],
|
|
|
|
|
fetchReply: true,
|
|
|
|
|
});
|
2022-11-09 14:44:05 +01:00
|
|
|
|
|
2023-10-13 15:04:11 +02:00
|
|
|
|
const latency = new EmbedBuilder()
|
|
|
|
|
.setColor(`#7961fd`)
|
|
|
|
|
.setTitle(`🏓 Pong ! Aprıl v4.0.0\n`)
|
|
|
|
|
.setDescription(
|
|
|
|
|
"\n" +
|
|
|
|
|
`**Latence :** ${
|
|
|
|
|
sent.createdTimestamp - interaction.createdTimestamp
|
|
|
|
|
}ms\n` +
|
|
|
|
|
`**API :** ${Math.round(client.ws.ping)}ms`,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
interaction.editReply({
|
|
|
|
|
content: " ",
|
|
|
|
|
embeds: [latency],
|
|
|
|
|
});
|
|
|
|
|
},
|
2022-11-09 14:44:05 +01:00
|
|
|
|
};
|