Send webhook notifications for inactivity updates
This commit is contained in:
@ -157,6 +157,32 @@ export async function onRequestPut(context: RequestContext) {
|
||||
},
|
||||
);
|
||||
|
||||
const departmentWebhooks = [];
|
||||
for (const department of departments)
|
||||
departmentWebhooks.push(context.env[`${department}_INACTIVITY_WEBHOOK`]);
|
||||
|
||||
const webhookPromises = [];
|
||||
for (const webhook of departmentWebhooks)
|
||||
webhookPromises.push(
|
||||
fetch(webhook, {
|
||||
body: JSON.stringify({
|
||||
embeds: [
|
||||
{
|
||||
title: "Inactivity Notice Modified",
|
||||
color: 37562560,
|
||||
description: `View the updated notice at https://carcrushers.cc/mod-queue?id=${context.params.id}&type=inactivity`,
|
||||
},
|
||||
],
|
||||
}),
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
},
|
||||
method: "POST",
|
||||
}),
|
||||
);
|
||||
|
||||
await Promise.allSettled(webhookPromises);
|
||||
|
||||
return new Response(null, {
|
||||
status: 204,
|
||||
});
|
||||
|
Reference in New Issue
Block a user