Let trusted apps add an embed and a link button to Discord direct messages
All checks were successful
Deploy Palico Bot / deploy (push) Successful in 7s

- POST /api/notifications/dm accepts optional embed (title, description, url, color, thumbnail, fields, footer, timestamp) and link fields; plain text stays required for phone notifications.
- Every value is checked against Discord's limits, and urls and thumbnails must use https; a refused embed answers 400 INVALID_EMBED.
- Sokko TCG uses it to show the destination, the result and the loot of its expedition alerts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-29 11:24:20 +01:00
parent 2471b5f6f7
commit 6ca17264e0
4 changed files with 131 additions and 5 deletions

View file

@ -9,7 +9,7 @@ function logDirectMessage(userId, status) {
console.log(`[${new Date().toLocaleString()}] DM ${target} → ${status}`);
}
// Messages privés envoyés pour une application de confiance (clé d'API) : `{ userId, content }`.
// Messages privés envoyés pour une application de confiance (clé d'API) : `{ userId, content, embed?, link? }`.
function notificationsRouter({ client }) {
const router = Router();