Add an authenticated route that sends Discord direct messages for trusted apps
Some checks failed
Deploy Palico Bot / deploy (push) Failing after 3s
Some checks failed
Deploy Palico Bot / deploy (push) Failing after 3s
- POST /api/notifications/dm takes a user id and a text, sends it as a direct message with no active mentions, and answers 204, 400, 404 or 422. - The send logic lives in src/features/directMessages.js with its own tests; the route gets its own per-minute rate limit behind the existing API key. - Sokko TCG uses it for its opt-in Expedition alerts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
20624a5c9c
commit
3655b1ad74
6 changed files with 183 additions and 56 deletions
|
|
@ -62,3 +62,11 @@ cp src/static/gameservers-list.example.json src/static/gameservers-list.json
|
|||
Un push sur `main` exécute les contrôles syntaxiques, les tests et l'audit npm
|
||||
avant d'appeler `/usr/local/bin/deploy-palico-bot` sur le serveur. Le workflow
|
||||
vérifie ensuite la route publique `/healthz`.
|
||||
|
||||
## Messages privés pour les applications
|
||||
|
||||
`POST /api/notifications/dm` (clé `WEB_API_KEY` en `Authorization: Bearer …`) envoie un message
|
||||
privé Discord : corps `{ "userId": "<identifiant Discord>", "content": "<texte, 2000 caractères au plus>" }`.
|
||||
Réponses : `204` envoyé, `400` corps invalide, `404` utilisateur inconnu, `422` messages privés
|
||||
impossibles (aucun serveur en commun avec le bot, ou messages privés fermés). Aucune mention n'est
|
||||
active dans le texte. Sokko TCG s'en sert pour ses alertes d'expédition, que chaque joueur active.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue