Update ticket's updatedAt property in msg event

This allows for messages to be closeall'd by the last message rather than creation date
This commit is contained in:
Oliver Cordingley 2021-01-23 18:20:31 +00:00
parent 0952d7fc37
commit 76572c5d18
No known key found for this signature in database
GPG Key ID: BDD85B6392EE03EA

View File

@ -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 } }); 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 if (message.author.bot || message.author.id === client.user.id) return; // goodbye bots