Ban command

This commit is contained in:
Tarrgon
2025-06-03 14:16:37 -04:00
parent b2e1b4beee
commit 77a482ac0f
11 changed files with 197 additions and 15 deletions
+22
View File
@@ -0,0 +1,22 @@
import { Client } from 'discord.js';
import { Database } from '../shared/Database';
import { config } from '../config';
export async function checkExpiredBans(client: Client) {
const guild = await client.guilds.fetch(config.DISCORD_GUILD_ID!);
if (!guild) return;
const date = new Date();
for (const ban of await Database.getExpiredBans(date)) {
try {
await guild.bans.remove(ban.user_id);
} catch (e) {
console.error(`Error unbanning user: ${ban.user_id}`);
console.error(e);
}
}
await Database.pruneExpiredBans(date);
}