Bewerbungen zusätzlich automatisch in Discord (Ticketanizer) posten
Jede eingehende Bewerbung landet weiterhin wie bisher in der D1-Datenbank, wird zusätzlich aber (falls eine Webhook-URL hinterlegt ist) als formatierte Discord-Nachricht in den passenden Kanal gepostet - pro Bewerbungsbereich (Modi/Scout/Creator/Kooperation) eine eigene Webhook-URL, exakt wie auf der Website getrennt. Läuft über normale Discord-Webhooks, kompatibel mit Ticketanizer, falls dessen Kanäle eigene Ziel-URLs im selben Format anbieten. - Neu: cloudflare-worker/src/lib/discord.js (Embed-Aufbau, Feld-Labels pro Formular, Farbe je Bewerbungsart) - applications.js: submitApplication ruft den Versand nach dem Speichern auf, über ctx.waitUntil() damit die Antwort an den Nutzer nicht wartet - worker.js: ctx wird jetzt an fetch() durchgereicht - Discord ist rein informativ - fehlt die Webhook-URL oder ist Discord kurz nicht erreichbar, wird die Bewerbung trotzdem ganz normal gespeichert - README.md: Einrichtungsanleitung (wrangler secret put DISCORD_WEBHOOK_*)
This commit is contained in:
@@ -228,7 +228,7 @@ const AUTHED_ROUTES = {
|
||||
};
|
||||
|
||||
export default {
|
||||
async fetch(request, env) {
|
||||
async fetch(request, env, ctx) {
|
||||
const url = new URL(request.url);
|
||||
const routeKey = `${request.method} ${url.pathname}`;
|
||||
|
||||
@@ -240,7 +240,7 @@ export default {
|
||||
return json({ ok: true, service: "dogfather-universe-interner-bereich" });
|
||||
}
|
||||
if (url.pathname === "/submit" && request.method === "POST") {
|
||||
return submitApplication(request, env);
|
||||
return submitApplication(request, env, ctx);
|
||||
}
|
||||
if (url.pathname === "/live-status" && request.method === "GET") {
|
||||
return handleLiveStatusGet(env);
|
||||
|
||||
Reference in New Issue
Block a user