counter not found is now an actual error that you can get

This commit is contained in:
Jill 2023-11-12 21:31:49 +03:00
parent 405c8b04b9
commit e65706c6f2
Signed by: oat
GPG Key ID: 33489AA58A955108
1 changed files with 13 additions and 7 deletions

View File

@ -85,6 +85,7 @@ export async function announceCounterUpdate(bot: Client, member: GuildMember, de
}
export async function changeCounterInteraction(interaction: CommandInteraction, member: GuildMember, amount: number, type: string) {
try {
const counter = await getCounterData(type);
const newCount = await changeCounter(amount, type);
@ -93,6 +94,11 @@ export async function changeCounterInteraction(interaction: CommandInteraction,
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}\`\`\``
});
} catch(err) {
interaction.followUp({
content: (err as Error).toString()
});
}
}
export async function counterAutocomplete(interaction: AutocompleteInteraction) {