fix: inactivity warning spam

This commit is contained in:
Isaac 2023-05-27 21:11:03 +01:00
parent c3620309bd
commit f69bc9a185
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33
2 changed files with 2 additions and 1 deletions

View File

@ -1159,6 +1159,7 @@ module.exports = class TicketManager {
closedBy = null, closedBy = null,
reason = null, reason = null,
}) { }) {
if (this.$stale.has(ticketId)) this.$stale.delete(ticketId);
let ticket = await this.getTicket(ticketId); let ticket = await this.getTicket(ticketId);
const getMessage = this.client.i18n.getLocale(ticket.guild.locale); const getMessage = this.client.i18n.getLocale(ticket.guild.locale);
this.$count.categories[ticket.categoryId].total -= 1; this.$count.categories[ticket.categoryId].total -= 1;

View File

@ -186,7 +186,7 @@ module.exports = class extends Listener {
// set inactive tickets as stale // set inactive tickets as stale
for (const guild of guilds) { for (const guild of guilds) {
for (const ticket of guild.tickets) { for (const ticket of guild.tickets) {
// if (ticket.lastMessageAt && ticket.lastMessageAt < Date.now() - guild.staleAfter) if (client.tickets.$stale.has(ticket.id)) continue;
if (ticket.lastMessageAt && Date.now() - ticket.lastMessageAt > guild.staleAfter) { if (ticket.lastMessageAt && Date.now() - ticket.lastMessageAt > guild.staleAfter) {
/** @type {import("discord.js").TextChannel} */ /** @type {import("discord.js").TextChannel} */
const channel = client.channels.cache.get(ticket.id); const channel = client.channels.cache.get(ticket.id);