counter not found is now an actual error that you can get
This commit is contained in:
parent
405c8b04b9
commit
e65706c6f2
|
@ -85,14 +85,20 @@ export async function announceCounterUpdate(bot: Client, member: GuildMember, de
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function changeCounterInteraction(interaction: CommandInteraction, member: GuildMember, amount: number, type: string) {
|
export async function changeCounterInteraction(interaction: CommandInteraction, member: GuildMember, amount: number, type: string) {
|
||||||
const counter = await getCounterData(type);
|
try {
|
||||||
|
const counter = await getCounterData(type);
|
||||||
|
|
||||||
const newCount = await changeCounter(amount, type);
|
const newCount = await changeCounter(amount, type);
|
||||||
await updateCounter(interaction.client, counter, newCount);
|
await updateCounter(interaction.client, counter, newCount);
|
||||||
await announceCounterUpdate(interaction.client, member, amount, counter, newCount);
|
await announceCounterUpdate(interaction.client, member, amount, counter, newCount);
|
||||||
interaction.followUp({
|
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}\`\`\``
|
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) {
|
export async function counterAutocomplete(interaction: AutocompleteInteraction) {
|
||||||
|
|
Loading…
Reference in New Issue