Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Command } from '@sapphire/framework';
- import { isMessageInstance } from '@sapphire/discord.js-utilities'
- export class PingCommand extends Command {
- constructor(context, options) {
- super(context, { ...options });
- }
- registerApplicationCommands(registry) {
- registry.registerChatInputCommand((builder) =>
- builder
- .setName('ping')
- .setDescription('Ping le bot pour vérifier s\'il est en ligne.')
- );
- }
- async chatInputRun(interaction) {
- const msg = await interaction.reply({ content: 'Ping ?' , ephemeral: true, fetchReply: true });
- if (isMessageInstance(msg)) {
- const diff = msg.createdTimestamp - interaction.createdTimestamp;
- const ping = Math.round(this.container.ws.ping);
- return interaction.editReply(`Pong ! L'allée-retour à pris ${diff}ms. Pouls : ${ping} ms.`)
- }
- return interaction.editReply('Impossible de récupérer le ping :(');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment