Finish rest of game appeal stuff
This commit is contained in:
@@ -10,11 +10,14 @@ export default async function (
|
||||
types?: string[];
|
||||
}> {
|
||||
if (
|
||||
await context.env.D1.prepare(
|
||||
"SELECT * FROM game_appeals WHERE roblox_id = ?;",
|
||||
)
|
||||
.bind(user)
|
||||
.first()
|
||||
await context.data.prisma.gameAppeal.findFirst({
|
||||
select: {
|
||||
id: true,
|
||||
},
|
||||
where: {
|
||||
roblox_id: user,
|
||||
},
|
||||
})
|
||||
)
|
||||
return {
|
||||
can_appeal: false,
|
||||
@@ -47,22 +50,20 @@ export default async function (
|
||||
).toLocaleString()} to submit another appeal`,
|
||||
};
|
||||
|
||||
const userLogs = await context.env.D1.prepare(
|
||||
"SELECT action, executed_at FROM game_mod_logs WHERE target = ? ORDER BY executed_at DESC;",
|
||||
)
|
||||
.bind(user)
|
||||
.all();
|
||||
|
||||
if (userLogs.error)
|
||||
return {
|
||||
error: "Could not determine your eligibility",
|
||||
};
|
||||
const userLogs = await context.data.prisma.gameModLog.findMany({
|
||||
select: {
|
||||
action: true,
|
||||
executed_at: true,
|
||||
},
|
||||
where: {
|
||||
target: user,
|
||||
},
|
||||
});
|
||||
|
||||
// Legacy bans
|
||||
if (!userLogs.results.length)
|
||||
return { can_appeal: true, reason: "", types: ["ban"] };
|
||||
if (!userLogs.length) 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)
|
||||
return {
|
||||
@@ -72,11 +73,7 @@ export default async function (
|
||||
).toLocaleString()} to submit an appeal`,
|
||||
};
|
||||
|
||||
if (
|
||||
userLogs.results.find((r: Record<string, any>) =>
|
||||
r.action.startsWith("accept appeal"),
|
||||
)
|
||||
)
|
||||
if (userLogs.find((r) => r.action.startsWith("accept appeal")))
|
||||
return {
|
||||
can_appeal: false,
|
||||
reason: "We do not accept appeals from repeat offenders",
|
||||
|
||||
Reference in New Issue
Block a user