Make Discord commands and the deploy pipeline sturdier
- Defer the voice commands' reply: updating every member can take longer than the 3 seconds Discord allows; one member leaving no longer fails the whole operation. - Replace the deprecated ephemeral option with MessageFlags, answer command errors in French and log when that answer itself fails; route autocomplete interactions to the command. - Add /readyz, which answers 503 while the bot is not connected to Discord. - Run npm ci and npm run check on every push; deploy main only when they pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a1cefe6da5
commit
362c7772ba
16 changed files with 245 additions and 176 deletions
|
|
@ -51,8 +51,15 @@ function createApp(
|
|||
app.use(helmet());
|
||||
app.use(express.json({ limit: "32kb" }));
|
||||
|
||||
// /healthz : le processus répond (sonde de vie). /readyz : le bot est aussi connecté à
|
||||
// Discord, sinon 503 (à utiliser pour la supervision).
|
||||
const discordReady = () => dependencies.client?.isReady?.() ?? false;
|
||||
app.get("/healthz", (_req, res) => {
|
||||
res.json({ status: "ok" });
|
||||
res.json({ status: "ok", discord: discordReady() ? "ready" : "not-ready" });
|
||||
});
|
||||
app.get("/readyz", (_req, res) => {
|
||||
const ready = discordReady();
|
||||
res.status(ready ? 200 : 503).json({ status: ready ? "ready" : "not-ready" });
|
||||
});
|
||||
|
||||
// Messages privés pour les applications de confiance : connexions locales uniquement,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue