fix(bots/discord/commands): minor issues

This commit is contained in:
PalmDevs
2024-06-24 23:18:27 +07:00
parent 0303fe3e36
commit 3b2596e748
3 changed files with 8 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ import { SlashCommandBuilder } from 'discord.js'
import type { Command } from '..' import type { Command } from '..'
import { config } from '$/context' import { config } from '$/context'
import { createSuccessEmbed } from '$/utils/discord/embeds'
import { cureNickname } from '$/utils/discord/moderation' import { cureNickname } from '$/utils/discord/moderation'
export default { export default {
@@ -19,8 +20,12 @@ export default {
global: false, global: false,
async execute(_, interaction) { async execute(_, interaction) {
const user = interaction.options.getUser('user', true) const user = interaction.options.getUser('member', true)
const member = await interaction.guild!.members.fetch(user.id) const member = await interaction.guild!.members.fetch(user.id)
await cureNickname(member) await cureNickname(member)
await interaction.reply({
embeds: [createSuccessEmbed(null, `Cured nickname for ${member.toString()}`)],
ephemeral: true,
})
}, },
} satisfies Command } satisfies Command

View File

@@ -45,7 +45,7 @@ export default {
'The provided member is not in the server or does not exist.', 'The provided member is not in the server or does not exist.',
) )
if (member.manageable) if (!member.manageable)
throw new CommandError(CommandErrorType.Generic, 'This user cannot be managed by the bot.') throw new CommandError(CommandErrorType.Generic, 'This user cannot be managed by the bot.')
if (moderator.roles.highest.comparePositionTo(member.roles.highest) <= 0 && !userIsOwner) if (moderator.roles.highest.comparePositionTo(member.roles.highest) <= 0 && !userIsOwner)

View File

@@ -50,7 +50,7 @@ export default {
'The provided member is not in the server or does not exist.', 'The provided member is not in the server or does not exist.',
) )
if (member.manageable) if (!member.manageable)
throw new CommandError(CommandErrorType.Generic, 'This user cannot be managed by the bot.') throw new CommandError(CommandErrorType.Generic, 'This user cannot be managed by the bot.')
if (action === 'apply') { if (action === 'apply') {