mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-02-23 18:51:29 +02:00
fix: /move
into new category (fixes #531)
This commit is contained in:
parent
c185afcdfe
commit
c1643f45ad
@ -103,15 +103,25 @@ module.exports = class MoveSlashCommand extends SlashCommand {
|
|||||||
where: { id: ticket.id },
|
where: { id: ticket.id },
|
||||||
});
|
});
|
||||||
|
|
||||||
const $oldCategory = client.tickets.$count.categories[ticket.categoryId];
|
// alias
|
||||||
const $newCategory = client.tickets.$count.categories[newCategory.id];
|
const $counters = client.tickets.$count.categories;
|
||||||
|
|
||||||
|
// make sure new category exist (#531)
|
||||||
|
$counters[newCategory.id] ??= {};
|
||||||
|
|
||||||
|
// more specific aliases
|
||||||
|
const $oldCategory = $counters[ticket.categoryId];
|
||||||
|
const $newCategory = $counters[newCategory.id];
|
||||||
|
|
||||||
|
// decrement old's total and member count
|
||||||
$oldCategory.total--;
|
$oldCategory.total--;
|
||||||
$oldCategory[ticket.createdById]--;
|
$oldCategory[ticket.createdById]--;
|
||||||
|
|
||||||
|
// increment new's totaL count
|
||||||
$newCategory.total ||= 0;
|
$newCategory.total ||= 0;
|
||||||
$newCategory.total++;
|
$newCategory.total++;
|
||||||
|
|
||||||
|
// increment new's member count
|
||||||
$newCategory[ticket.createdById] ||= 0;
|
$newCategory[ticket.createdById] ||= 0;
|
||||||
$newCategory[ticket.createdById]++;
|
$newCategory[ticket.createdById]++;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user