Send opt-in Discord alerts for Sokko TCG Expeditions through palico-bot
- Players turn on alerts one by one in their account: someone opens an expedition group, or one of their expeditions returns; both stay off until chosen. - Opening a group queues a direct message for each other subscribed player; every 30 seconds the server queues returned expeditions once and sends pending messages to palico-bot's direct message route. - Permanent refusals (unknown account, closed direct messages) or five failures stop retries; only real Discord accounts receive alerts, and sent rows are purged after 30 days. - CARDS_DISCORD_ALERTS_URL and CARDS_DISCORD_ALERTS_KEY enable the feature; Administration › Guilde can turn every alert off, and the privacy notice explains what is sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6828683f1d
commit
320498d878
24 changed files with 387 additions and 13 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// Rôle : démarre le build avec une base Sokko TCG temporaire pour les parcours Playwright.
|
||||
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { appendFileSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
|
||||
|
|
@ -57,7 +57,11 @@ const { startServer } = await import("../server.mjs");
|
|||
const draws = [0.999, 0, 0.999, 0.999, 0.999, 0];
|
||||
let drawIndex = 0;
|
||||
// Tous les parcours et leurs deux comptes partagent la même adresse IP : la limite par minute les ferait échouer au hasard.
|
||||
const server = startServer({ cardsApiOptions: { allowProductionDevAuth: true, apiRateLimit: 100_000, now, random: (max) => Math.min(max - 1, Math.floor(draws[drawIndex++ % draws.length] * max)) } });
|
||||
// Alertes Discord sans bot : chaque message est écrit dans ce fichier, une ligne JSON par alerte.
|
||||
const alertsFile = join(tmpdir(), "sokkog-cards-e2e-alerts.jsonl");
|
||||
writeFileSync(alertsFile, "");
|
||||
const sendAlert = async (discordId, content) => appendFileSync(alertsFile, `${JSON.stringify({ discordId, content })}\n`);
|
||||
const server = startServer({ cardsApiOptions: { allowProductionDevAuth: true, apiRateLimit: 100_000, now, sendAlert, random: (max) => Math.min(max - 1, Math.floor(draws[drawIndex++ % draws.length] * max)) } });
|
||||
let stopping = false;
|
||||
|
||||
function stop() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue