Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
bro...
  • Loading branch information
regalijan committed Nov 1, 2023
1 parent c124aa2 commit e40eb9e
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions functions/api/game-appeals/submit.ts
Expand Up @@ -23,13 +23,13 @@ export async function onRequestPost(context: RequestContext) {
if (reasonForUnban.length > 5000 || whatHappened.length > 5000)
return jsonError(
"The maximum length of each text field is 5000 characters",
400
400,
);

if (reasonForUnban.length < 100)
return jsonError(
"Your explanation of why you should be unbanned must be longer",
400
400,
);

if (whatHappened.length < 50)
Expand All @@ -54,31 +54,33 @@ export async function onRequestPost(context: RequestContext) {
reasonForUnban,
roblox_id: id,
roblox_username: username,
whatHappened
})
whatHappened,
}),
);

await context.env.D1.prepare(
"INSERT INTO game_appeals (created_at, id, open, user) VALUES (?, ?, ?, ?);"
).bind(Date.now(), appealId, 1, id);
"INSERT INTO game_appeals (created_at, id, open, user) VALUES (?, ?, ?, ?);",
)
.bind(Date.now(), appealId, 1, id)
.run();

await fetch(context.env.REPORTS_WEBHOOK, {
body: JSON.stringify({
embeds: [
{
color: 3756250,
description: `${username} has pleaded for forgiveness! Head to https://carcrushers.cc/mod-queue?id=${appealId}&type=gma`,
title: "Appeal Submitted"
}
]
title: "Appeal Submitted",
},
],
}),
headers: {
"content-type": "application/json"
"content-type": "application/json",
},
method: "POST"
method: "POST",
});

return new Response(null, {
status: 204
status: 204,
});
}

0 comments on commit e40eb9e

Please sign in to comment.