From 24101311f09ae66f7583118562f102008df3b03f Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Wed, 18 Jan 2023 11:28:11 -0800 Subject: [PATCH] Attempt to fix inaccurate bonk counter --- src/commands/bonk.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/commands/bonk.ts b/src/commands/bonk.ts index d835355..9a4b442 100644 --- a/src/commands/bonk.ts +++ b/src/commands/bonk.ts @@ -3,19 +3,18 @@ import { TClient } from 'src/client'; export default { async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){ //if (!client.isStaff(interaction.member) && interaction.channelId == '468835415093411863') return interaction.reply('This command is restricted to staff only in this channel due to high usage.') - const member = interaction.options.getMember('member'); + const member = interaction.options.getMember('member') as Discord.GuildMember; const reason = interaction.options.getString('reason'); const adminPerm = member.permissions.has('Administrator'); - if (adminPerm) return interaction.reply('You cannot bonk an admin!') - if (member) { - const embed = new client.embed().setColor(client.config.embedColor) + if (adminPerm) return interaction.reply('You cannot bonk an admin!'); + + await client.bonkCount._incrementUser(member.id).forceSave(); + const embed = new client.embed().setColor(client.config.embedColor) .setDescription(`> <@${member.id}> has been bonked!\n${reason?.length == null ? '' : `> Reason: **${reason}**`}`) .setImage('https://media.tenor.com/7tRddlNUNNcAAAAd/hammer-on-head-minions.gif') .setFooter({text: `Bonk count for ${member.user.tag}: ${await client.bonkCount.getUser(member.id).toLocaleString('en-US')}`}) - interaction.reply({embeds: [embed]}) - client.bonkCount._incrementUser(member.id).forceSave(); - } + interaction.reply({embeds: [embed]}); }, data: new SlashCommandBuilder() .setName('bonk') @@ -27,4 +26,4 @@ export default { .addStringOption((opt)=>opt .setName('reason') .setDescription('Reason for the bonk')) -} \ No newline at end of file +}