diff --git a/src/lib/counter.ts b/src/lib/counter.ts index 9b39ef8..415a839 100644 --- a/src/lib/counter.ts +++ b/src/lib/counter.ts @@ -36,11 +36,11 @@ export async function getCounterData(type: string) { return counter; } -export async function updateCounter(bot: Client, counter: Counter) { +export async function updateCounter(bot: Client, counter: Counter, value: number) { const channel = await bot.channels.fetch(counter.channel) as TextChannel; const messageID = counter.message; - const content = `[${counter.emoji}] x${counter.value}`; + const content = `[${counter.emoji}] x${value}`; // bit janky // yeah you don't say @@ -64,7 +64,7 @@ export async function updateCounter(bot: Client, counter: Counter) { } } -export async function announceCounterUpdate(bot: Client, member: GuildMember, delta: number, counter: Counter) { +export async function announceCounterUpdate(bot: Client, member: GuildMember, delta: number, counter: Counter, value: number) { const channel = await bot.channels.fetch(counter.channel) as TextChannel; const embed = new EmbedBuilder() @@ -76,7 +76,7 @@ export async function announceCounterUpdate(bot: Client, member: GuildMember, de .setColor(member.displayColor) .setTimestamp() .setFooter({ - text: `[${counter.emoji}] x${counter.value}` + text: `[${counter.emoji}] x${value}` }); await channel.send({ @@ -88,8 +88,8 @@ export async function changeCounterInteraction(interaction: CommandInteraction, const counter = await getCounterData(type); const newCount = await changeCounter(amount, type); - await updateCounter(interaction.client, counter); - await announceCounterUpdate(interaction.client, member, amount, counter); + await updateCounter(interaction.client, counter, newCount); + await announceCounterUpdate(interaction.client, member, amount, counter, newCount); interaction.followUp({ content: `${counter.emoji} **You have ${amount > 0 ? 'increased' : 'decreased'} the counter.**\n\`\`\`diff\n ${newCount - amount}\n${getSign(amount)}${Math.abs(amount)}\n ${newCount}\`\`\`` });