fix(bots/discord): set timeout for eligible mutes to unmute faster

This commit is contained in:
PalmDevs
2024-07-26 00:05:08 +07:00
parent b79a1c7575
commit 1f5c5a92a6

View File

@@ -1,7 +1,7 @@
import { SlashCommandBuilder } from 'discord.js'
import CommandError, { CommandErrorType } from '$/classes/CommandError'
import { applyRolePreset } from '$/utils/discord/rolePresets'
import { applyRolePreset, removeRolePreset } from '$/utils/discord/rolePresets'
import type { Command } from '../types'
import { config } from '$/context'
@@ -60,6 +60,10 @@ export default {
createModerationActionEmbed('Muted', user, interaction.user, reason, durationMs),
)
if (durationMs) setTimeout(() => {
removeRolePreset(member, 'mute')
}, durationMs)
logger.info(
`Moderator ${interaction.user.tag} (${interaction.user.id}) muted ${user.tag} (${user.id}) until ${expires} because ${reason}`,
)