diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-23 22:02:44 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-23 22:02:44 -0400 |
commit | b015bec7f66526ec5e959ae99865845f4db4b181 (patch) | |
tree | 67538c9549b7e0f7cd6a97e9c82db8d8462a19c7 /src/tasks/unban.ts | |
parent | 5c242f597595b8db71875d92c0afe0a5947442a6 (diff) | |
download | tanzanite-b015bec7f66526ec5e959ae99865845f4db4b181.tar.gz tanzanite-b015bec7f66526ec5e959ae99865845f4db4b181.tar.bz2 tanzanite-b015bec7f66526ec5e959ae99865845f4db4b181.zip |
feat: some shit
- fix breaking changes
- refactored active punishments into one table
- made listeners args have stricter types
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}`); - } - } -} |