Files
flint/src/commands/ping.ts
T
Puechberty Arthur 0f82c7e287 feat: add utility commands for member messages and presence management
- Implement `goodbye` command to configure goodbye messages.
- Implement `help` command to provide a global help embed with command details.
- Implement `kiss` command to send a kiss message to a mentioned user.
- Create `memberMessagePanel` for managing welcome and goodbye messages.
- Implement `ping` command to check bot latency.
- Implement `presence` command to manage bot presence settings.
- Implement `welcome` command to configure welcome messages.
2026-04-12 23:08:03 +02:00

33 lines
855 B
TypeScript

/**
* Commande `ping` (utility)
*
* Répond avec un message court contenant la latence websocket du bot.
*/
import { MessageFlags } from "discord.js";
import { defineCommand } from "../framework/commands/defineCommand.js";
/** Commande `ping` — affiche la latence du bot. */
export const pingCommand = defineCommand({
meta: {
name: "ping",
category: "utility",
},
cooldown: 5,
examples: [
{
descriptionKey: "examples.basic",
},
],
execute: async (ctx) => {
const responses = (ctx.commandText.responses as Record<string, unknown> | undefined) ?? {};
const template = typeof responses.pong === "string" ? responses.pong : "Pong {{latency}}ms";
await ctx.reply({
content: ctx.format(template, {
latency: ctx.client.ws.ping,
}),
flags: [MessageFlags.Ephemeral],
});
},
});