generated from nhcarrigan/template
chore: cleanup
All checks were successful
Node.js CI / Lint and Test (pull_request) Successful in 30s
All checks were successful
Node.js CI / Lint and Test (pull_request) Successful in 30s
This commit is contained in:
@ -129,40 +129,40 @@ export const instantiateServer = (): void => {
|
|||||||
"x-signature-timestamp": string;
|
"x-signature-timestamp": string;
|
||||||
}; }>(
|
}; }>(
|
||||||
"/entitlement",
|
"/entitlement",
|
||||||
|
// eslint-disable-next-line complexity -- Fuck off.
|
||||||
async(request, response) => {
|
async(request, response) => {
|
||||||
|
const { type, application_id: applicationId, event } = request.body;
|
||||||
|
const appInfo = applicationData[applicationId];
|
||||||
const isValid = await validateWebhook(request);
|
const isValid = await validateWebhook(request);
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
await response.status(401).send({ success: false });
|
await response.status(401).send({ success: false });
|
||||||
void sendDiscord(
|
void sendDiscord(
|
||||||
"[NOTIFICATION]: Entitlement Event",
|
`[ENTITLEMENT]: ${appInfo?.name ?? applicationId}`,
|
||||||
"An invalid webhook signature was received.",
|
"An invalid webhook signature was received.",
|
||||||
);
|
);
|
||||||
void sendMail(
|
void sendMail(
|
||||||
"[NOTIFICATION]: Entitlement Event",
|
`[ENTITLEMENT]: ${appInfo?.name ?? applicationId}`,
|
||||||
"An invalid webhook signature was received.",
|
"An invalid webhook signature was received.",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await response.status(204).send();
|
await response.status(204).send();
|
||||||
const { type } = request.body;
|
|
||||||
if (type === 0) {
|
if (type === 0) {
|
||||||
void sendDiscord(
|
void sendDiscord(
|
||||||
"[NOTIFICATION]: Entitlement Event",
|
`[ENTITLEMENT]: ${appInfo?.name ?? applicationId}`,
|
||||||
"Received a ping from Discord.",
|
"Received a ping from Discord.",
|
||||||
);
|
);
|
||||||
void sendMail(
|
void sendMail(
|
||||||
"[NOTIFICATION]: Entitlement Event",
|
`[ENTITLEMENT]: ${appInfo?.name ?? applicationId}`,
|
||||||
"Received a ping from Discord.",
|
"Received a ping from Discord.",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { application_id: applicationId, event } = request.body;
|
|
||||||
const {
|
const {
|
||||||
user_id: userId,
|
user_id: userId,
|
||||||
guild_id: guildId,
|
guild_id: guildId,
|
||||||
ends_at: endsAt,
|
ends_at: endsAt,
|
||||||
} = event.data;
|
} = event.data;
|
||||||
const appInfo = applicationData[applicationId];
|
|
||||||
await sendDiscord(
|
await sendDiscord(
|
||||||
`[ENTITLEMENT]: ${appInfo?.name ?? applicationId}`,
|
`[ENTITLEMENT]: ${appInfo?.name ?? applicationId}`,
|
||||||
`Entitlement purchased!\n- **User ID**: ${userId}\n- **Guild ID**: ${guildId}\n- **Ends At**: ${endsAt}`,
|
`Entitlement purchased!\n- **User ID**: ${userId}\n- **Guild ID**: ${guildId}\n- **Ends At**: ${endsAt}`,
|
||||||
|
Reference in New Issue
Block a user