Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit 000dece

Browse files
committed
fix(blacklist): fix blacklist expiry
1 parent 657b0db commit 000dece

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

src/scheduled/tasks/updateBlacklists.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,22 @@ export default async (client: Client) => {
1212

1313
allInfractions?.forEach(async (infrac) => {
1414
const type = infrac.userId ? 'user' : 'server';
15+
const targetId = infrac.userId ?? infrac.serverId!;
1516

16-
const blacklistManager =
17-
type === 'user'
18-
? new BlacklistManager('user', infrac.id)
19-
: new BlacklistManager('server', infrac.id);
20-
17+
const blacklistManager = new BlacklistManager(type, targetId);
2118
await blacklistManager.removeBlacklist(infrac.hubId);
2219

2320
if (client.user) {
21+
const opts = {
22+
id: targetId,
23+
mod: client.user,
24+
reason: 'Blacklist duration expired.',
25+
};
2426
if (type === 'user') {
25-
await logUserUnblacklist(client, new HubManager(infrac.hub), {
26-
id: infrac.id,
27-
mod: client.user,
28-
reason: 'Blacklist duration expired.',
29-
});
27+
await logUserUnblacklist(client, new HubManager(infrac.hub), opts);
3028
}
3129
else if (type === 'server') {
32-
await logServerUnblacklist(client, new HubManager(infrac.hub), {
33-
id: infrac.id,
34-
mod: client.user,
35-
reason: 'Blacklist duration expired.',
36-
});
30+
await logServerUnblacklist(client, new HubManager(infrac.hub), opts);
3731
}
3832
}
3933
});

0 commit comments

Comments
 (0)