diff --git a/functions/api/appeals/[id]/accept.ts b/functions/api/appeals/[id]/accept.ts index 92aa033..a7b5040 100644 --- a/functions/api/appeals/[id]/accept.ts +++ b/functions/api/appeals/[id]/accept.ts @@ -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})`, }, ], }, diff --git a/functions/api/appeals/[id]/deny.ts b/functions/api/appeals/[id]/deny.ts index 0029732..8e9ef06 100644 --- a/functions/api/appeals/[id]/deny.ts +++ b/functions/api/appeals/[id]/deny.ts @@ -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})`, }, ], },