fix: auto ban event not sending a task to the discord bot

This commit is contained in:
Miodec 2025-01-26 20:46:30 +01:00
parent bb3a99861f
commit 2000cd92c6

View file

@ -36,6 +36,7 @@ import { addImportantLog } from "./logs";
import { Result as ResultType } from "@monkeytype/contracts/schemas/results";
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
import { isToday, isYesterday } from "@monkeytype/util/date-and-time";
import GeorgeQueue from "../queues/george-queue";
export type DBUserTag = WithObjectId<UserTag>;
@ -843,6 +844,7 @@ export async function recordAutoBanEvent(
const user = await getPartialUser(uid, "record auto ban event", [
"banned",
"autoBanTimestamps",
"discordId",
]);
let ret = false;
@ -878,6 +880,13 @@ export async function recordAutoBanEvent(
{ autoBanTimestamps, banningUser },
uid
);
const discordIdIsValid =
user.discordId !== undefined && user.discordId !== "";
if (discordIdIsValid) {
await GeorgeQueue.userBanned(user.discordId as string, true);
}
return ret;
}