Update game appeal log query
This commit is contained in:
parent
0fb7bf6686
commit
1adda195f0
@ -1,4 +1,3 @@
|
|||||||
import { queryLogs } from "../../gcloud.js";
|
|
||||||
import { getBanList } from "../../roblox-open-cloud.js";
|
import { getBanList } from "../../roblox-open-cloud.js";
|
||||||
|
|
||||||
export default async function (
|
export default async function (
|
||||||
@ -48,7 +47,13 @@ export default async function (
|
|||||||
let userLogs;
|
let userLogs;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
userLogs = await queryLogs(user, context);
|
userLogs = await context.env.D1.prepare(
|
||||||
|
"SELECT executed_at FROM game_mod_logs WHERE target = ? ORDER bv executed_at DESC;",
|
||||||
|
)
|
||||||
|
.bind(user)
|
||||||
|
.all();
|
||||||
|
|
||||||
|
if (userLogs.error) throw new Error("Query failed");
|
||||||
} catch {
|
} catch {
|
||||||
return {
|
return {
|
||||||
error: "Could not determine your eligibility",
|
error: "Could not determine your eligibility",
|
||||||
@ -56,18 +61,9 @@ export default async function (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Legacy bans
|
// Legacy bans
|
||||||
if (!userLogs.length) return { can_appeal: true, reason: "" };
|
if (!userLogs.results.length) return { can_appeal: true, reason: "" };
|
||||||
|
|
||||||
userLogs.sort((a, b) =>
|
const allowedTime = (userLogs.results[0].executed_at as number) + 2592000000;
|
||||||
parseInt(a.entity.properties.executed_at.integerValue) >
|
|
||||||
parseInt(b.entity.properties.executed_at.integerValue)
|
|
||||||
? -1
|
|
||||||
: 1,
|
|
||||||
);
|
|
||||||
|
|
||||||
const allowedTime =
|
|
||||||
parseInt(userLogs[0].entity.properties.executed_at.integerValue) +
|
|
||||||
2592000000;
|
|
||||||
|
|
||||||
if (Date.now() < allowedTime)
|
if (Date.now() < allowedTime)
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user