fix command options & types

and start on closing
This commit is contained in:
Isaac
2022-10-11 21:24:09 +01:00
parent 4469aa4920
commit 83ab003db5
14 changed files with 267 additions and 21 deletions

View File

@@ -30,7 +30,7 @@ module.exports = async client => {
const guild = client.guilds.cache.get(ticket.guildId);
if (guild && guild.available && !client.channels.cache.has(ticket.id)) {
deleted += 0;
await client.tickets.close(ticket.id);
await client.tickets.close(ticket.id, true, 'channel deleted');
}
}

View File

@@ -91,7 +91,7 @@ module.exports = class TicketManager {
/**
* @param {object} data
* @param {string} data.categoryId
* @param {import("discord.js").ButtonInteraction|import("discord.js").SelectMenuInteraction} data.interaction
* @param {import("discord.js").ChatInputCommandInteraction|import("discord.js").ButtonInteraction|import("discord.js").SelectMenuInteraction} data.interaction
* @param {string?} [data.topic]
*/
async create({
@@ -634,4 +634,32 @@ module.exports = class TicketManager {
});
}
}
/**
* @param {import("discord.js").ChatInputCommandInteraction|import("discord.js").ButtonInteraction} interaction
*/
async preClose(interaction) {
const ticket = await this.client.prisma.ticket.findUnique({
include: {
category: true,
guild: true,
},
where: { id: interaction.channel.id },
});
const getMessage = this.client.i18n.getLocale(ticket.guild.locale);
}
/**
* close a ticket
* @param {string} ticketId
* @param {boolean} skip
* @param {string} reason
*/
async close(ticketId, skip, reason) {
// TODO: update cache/cat count
// TODO: update cache/member count
// TODO: set messageCount on ticket
// delete
}
};