Finish rest of game appeal stuff

This commit is contained in:
2026-04-11 04:29:25 -04:00
parent b60f211d7b
commit 48631e32be

View File

@@ -10,11 +10,14 @@ export default async function (
types?: string[]; types?: string[];
}> { }> {
if ( if (
await context.env.D1.prepare( await context.data.prisma.gameAppeal.findFirst({
"SELECT * FROM game_appeals WHERE roblox_id = ?;", select: {
) id: true,
.bind(user) },
.first() where: {
roblox_id: user,
},
})
) )
return { return {
can_appeal: false, can_appeal: false,
@@ -47,22 +50,20 @@ export default async function (
).toLocaleString()} to submit another appeal`, ).toLocaleString()} to submit another appeal`,
}; };
const userLogs = await context.env.D1.prepare( const userLogs = await context.data.prisma.gameModLog.findMany({
"SELECT action, executed_at FROM game_mod_logs WHERE target = ? ORDER BY executed_at DESC;", select: {
) action: true,
.bind(user) executed_at: true,
.all(); },
where: {
if (userLogs.error) target: user,
return { },
error: "Could not determine your eligibility", });
};
// Legacy bans // Legacy bans
if (!userLogs.results.length) if (!userLogs.length) return { can_appeal: true, reason: "", types: ["ban"] };
return { can_appeal: true, reason: "", types: ["ban"] };
const allowedTime = (userLogs.results[0].executed_at as number) + 2592000000; const allowedTime = new Date(userLogs[0].executed_at).getTime() + 2592000000;
if (Date.now() < allowedTime) if (Date.now() < allowedTime)
return { return {
@@ -72,11 +73,7 @@ export default async function (
).toLocaleString()} to submit an appeal`, ).toLocaleString()} to submit an appeal`,
}; };
if ( if (userLogs.find((r) => r.action.startsWith("accept appeal")))
userLogs.results.find((r: Record<string, any>) =>
r.action.startsWith("accept appeal"),
)
)
return { return {
can_appeal: false, can_appeal: false,
reason: "We do not accept appeals from repeat offenders", reason: "We do not accept appeals from repeat offenders",