diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-14 13:29:19 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-14 13:29:19 -0400 |
commit | eaaae08aeee1fa16a4e1ad0b26fceb42885bfcde (patch) | |
tree | 6c1501af87225b478c9ebdc39e0712e0d4835a08 /src/tasks | |
parent | 070b5f326d0647e7b105f99811e4bdc915c8652e (diff) | |
download | tanzanite-eaaae08aeee1fa16a4e1ad0b26fceb42885bfcde.tar.gz tanzanite-eaaae08aeee1fa16a4e1ad0b26fceb42885bfcde.tar.bz2 tanzanite-eaaae08aeee1fa16a4e1ad0b26fceb42885bfcde.zip |
add punishent footer command
Diffstat (limited to 'src/tasks')
-rw-r--r-- | src/tasks/removePunishmentRole.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tasks/removePunishmentRole.ts b/src/tasks/removePunishmentRole.ts index d957238..9830338 100644 --- a/src/tasks/removePunishmentRole.ts +++ b/src/tasks/removePunishmentRole.ts @@ -16,13 +16,18 @@ export default class RemovePunishmentRole extends BushTask { for (const entry of expiredEntries) { const guild = this.client.guilds.cache.get(entry.guild); - if (!guild) { + const role = guild?.roles?.cache?.get(entry.role); + if (!guild || !role) { await entry.destroy(); continue; } const member = guild.members.cache.get(entry.user) as BushGuildMember; - const result = await member.removePunishRole({ reason: 'Punishment expired.', role: entry.role }); + const result = await member.removeRole({ + reason: 'Punishment expired.', + role: role, + addToModlog: true + }); if (['success', 'failed to dm'].includes(result)) await entry.destroy(); else throw result; |