Make appeal action endpoints un-useless
This commit is contained in:
parent
962509aff2
commit
736543c374
@ -30,12 +30,16 @@ export async function onRequestPost(context: RequestContext) {
|
||||
|
||||
const { current_user: currentUser } = context.data;
|
||||
|
||||
await context.env.D1.prepare("UPDATE appeals SET open = 0 WHERE id = ?;")
|
||||
.bind(context.params.id)
|
||||
.run();
|
||||
|
||||
await fetch(
|
||||
`https://discord.com/api/v10/guilds/242263977986359297/bans/${appeal.id}`,
|
||||
{
|
||||
headers: {
|
||||
authorization: `Bot ${context.env.BOT_TOKEN}`,
|
||||
"x-audit-log-reason": `Appeal accepted by ${currentUser.username}#${currentUser.discriminator} (${currentUser.id})`,
|
||||
"x-audit-log-reason": `Appeal accepted by ${currentUser.username} (${currentUser.id})`,
|
||||
},
|
||||
method: "DELETE",
|
||||
},
|
||||
@ -47,11 +51,11 @@ export async function onRequestPost(context: RequestContext) {
|
||||
{
|
||||
title: "Appeal Accepted",
|
||||
color: 0x00ff00,
|
||||
description: `Appeal from user ${appeal.username}#${appeal.discriminator} (${appeal.id}) was accepted.`,
|
||||
description: `Appeal from user ${appeal.username} (${appeal.id}) was accepted.`,
|
||||
fields: [
|
||||
{
|
||||
name: "Moderator",
|
||||
value: `${currentUser.username}#${currentUser.discriminator} (${currentUser.id})`,
|
||||
value: `${currentUser.username} (${currentUser.id})`,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -28,6 +28,10 @@ export async function onRequestPost(context: RequestContext) {
|
||||
});
|
||||
}
|
||||
|
||||
await context.env.D1.prepare("UPDATE appeals SET open = 0 WHERE id = ?;")
|
||||
.bind(context.params.id)
|
||||
.run();
|
||||
|
||||
const { current_user: currentUser } = context.data;
|
||||
|
||||
await fetch(context.env.APPEALS_WEBHOOK, {
|
||||
@ -36,11 +40,11 @@ export async function onRequestPost(context: RequestContext) {
|
||||
{
|
||||
title: "Appeal Denied",
|
||||
color: 0xff0000,
|
||||
description: `Appeal from user ${appeal.username}#${appeal.discriminator} (${appeal.id}) was denied.`,
|
||||
description: `Appeal from user ${appeal.username} (${appeal.id}) was denied.`,
|
||||
fields: [
|
||||
{
|
||||
name: "Moderator",
|
||||
value: `${currentUser.username}#${currentUser.discriminator} (${currentUser.id})`,
|
||||
value: `${currentUser.username} (${currentUser.id})`,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user