Ping roles on inactivity webhook message
This commit is contained in:
parent
0f257ce42f
commit
89ff059176
@ -49,16 +49,20 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
.run();
|
.run();
|
||||||
|
|
||||||
const departmentsToNotify = [];
|
const departmentsToNotify = [];
|
||||||
|
const departmentRoles = [];
|
||||||
const { env } = context;
|
const { env } = context;
|
||||||
|
|
||||||
for (const department of departments)
|
for (const department of departments) {
|
||||||
departmentsToNotify.push(env[`${department}_INACTIVITY_WEBHOOK`]);
|
departmentsToNotify.push(env[`${department}_INACTIVITY_WEBHOOK`]);
|
||||||
|
departmentRoles.push(env[`${department}_INACTIVITY_ROLE`]);
|
||||||
|
}
|
||||||
|
|
||||||
const webhookPromises = [];
|
const webhookPromises = [];
|
||||||
for (const departmentWebhook of departmentsToNotify)
|
for (let i = 0; i < departmentsToNotify.length; i++)
|
||||||
webhookPromises.push(
|
webhookPromises.push(
|
||||||
fetch(departmentWebhook, {
|
fetch(departmentsToNotify[i], {
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
content: `<@&${departmentRoles[i]}>`,
|
||||||
embeds: [
|
embeds: [
|
||||||
{
|
{
|
||||||
title: "Inactivity Notice Submitted",
|
title: "Inactivity Notice Submitted",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user