Skip to content

Commit 2000cd9

Browse files
committed
fix: auto ban event not sending a task to the discord bot
1 parent bb3a998 commit 2000cd9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

backend/src/dal/user.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { addImportantLog } from "./logs";
3636
import { Result as ResultType } from "@monkeytype/contracts/schemas/results";
3737
import { Configuration } from "@monkeytype/contracts/schemas/configuration";
3838
import { isToday, isYesterday } from "@monkeytype/util/date-and-time";
39+
import GeorgeQueue from "../queues/george-queue";
3940

4041
export type DBUserTag = WithObjectId<UserTag>;
4142

@@ -843,6 +844,7 @@ export async function recordAutoBanEvent(
843844
const user = await getPartialUser(uid, "record auto ban event", [
844845
"banned",
845846
"autoBanTimestamps",
847+
"discordId",
846848
]);
847849

848850
let ret = false;
@@ -878,6 +880,13 @@ export async function recordAutoBanEvent(
878880
{ autoBanTimestamps, banningUser },
879881
uid
880882
);
883+
884+
const discordIdIsValid =
885+
user.discordId !== undefined && user.discordId !== "";
886+
if (discordIdIsValid) {
887+
await GeorgeQueue.userBanned(user.discordId as string, true);
888+
}
889+
881890
return ret;
882891
}
883892

0 commit comments

Comments
 (0)