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
|
|
@ -114,3 +114,16 @@ test("only loopback connections count as local", () => {
|
|||
assert.equal(isLoopbackAddress(address), false);
|
||||
}
|
||||
});
|
||||
|
||||
test("/readyz reports whether the bot is connected to Discord", async () => {
|
||||
const app = createApp({ queue: fakeQueue, client: { isReady: () => false } });
|
||||
const server = app.listen(0, "127.0.0.1");
|
||||
await new Promise((resolve) => server.once("listening", resolve));
|
||||
const base = `http://127.0.0.1:${server.address().port}`;
|
||||
try {
|
||||
assert.equal((await fetch(`${base}/healthz`)).status, 200);
|
||||
assert.equal((await fetch(`${base}/readyz`)).status, 503);
|
||||
} finally {
|
||||
await new Promise((resolve) => server.close(resolve));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue