diff options
Diffstat (limited to 'src/tasks/unban.ts')
-rw-r--r-- | src/tasks/unban.ts | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/src/tasks/unban.ts b/src/tasks/unban.ts deleted file mode 100644 index 136e6c2..0000000 --- a/src/tasks/unban.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { BushGuild, BushTask } from '@lib'; - -export default class UnbanTask extends BushTask { - public constructor() { - super('unban', { - delay: 30_000, // 1/2 min - runOnStart: true - }); - } - async exec(): Promise<void> { - const rows = await this.client.util.findExpiredEntries('mute'); - this.client.logger.verbose(`UnbanTask`, `Queried bans, found <<${rows.length}>> expired bans.`); - - for (const row of rows) { - const guild = this.client.guilds.cache.get(row.guild) as BushGuild; - if (!guild) { - await row.destroy(); - continue; - } - - const result = await guild.unban({ user: row.user, reason: 'Punishment expired.' }); - if (['success', 'user not banned'].includes(result)) await row.destroy(); - else throw result; - this.client.logger.verbose(`UnbanTask`, `Unbanned ${row.user}`); - } - } -} |