From 76572c5d182f27f2cd22eff650b46a71fe39979c Mon Sep 17 00:00:00 2001 From: Oliver Cordingley Date: Sat, 23 Jan 2021 18:20:31 +0000 Subject: [PATCH] Update ticket's updatedAt property in msg event This allows for messages to be closeall'd by the last message rather than creation date --- src/events/message.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/events/message.js b/src/events/message.js index f5aea2a..58bc428 100644 --- a/src/events/message.js +++ b/src/events/message.js @@ -30,7 +30,12 @@ Type \`${config.prefix}new\` on the server to create a new ticket.`); */ let ticket = await Ticket.findOne({ where: { channel: message.channel.id } }); - if (ticket) archive.add(message); // add message to archive + if (ticket) { + archive.add(message); // add message to archive + // Update the ticket updated at so closeall can get most recent + ticket.changed('updatedAt', true); + ticket.save(); + } if (message.author.bot || message.author.id === client.user.id) return; // goodbye bots