Ticket creation error handling

This commit is contained in:
Isaac
2021-05-11 11:52:23 +01:00
parent 10f449fc2d
commit c9609a41b5
8 changed files with 28 additions and 22 deletions

View File

@@ -156,6 +156,11 @@ module.exports = class TicketManager extends EventEmitter {
if (!cat_row)
throw new Error('Ticket category does not exist');
let cat_channel = await this.client.channels.fetch(category_id);
if (cat_channel.children.size >= 50)
throw new Error('Ticket category has reached child channel limit (50)');
let number = (await this.client.db.models.Ticket.count({
where: {