Fix thread channel being deleted before the close message is sent
parent
1df7ba3e64
commit
fa84fa6034
|
@ -66,6 +66,7 @@ module.exports = ({ bot, knex, config, commands }) => {
|
|||
|
||||
let hasCloseMessage = !! config.closeMessage;
|
||||
let silentClose = false;
|
||||
let suppressSystemMessages = false;
|
||||
|
||||
if (msg.channel instanceof Eris.PrivateChannel) {
|
||||
// User is closing the thread by themselves (if enabled)
|
||||
|
@ -79,7 +80,7 @@ module.exports = ({ bot, knex, config, commands }) => {
|
|||
// between showing the close command in the thread and closing the thread
|
||||
await messageQueue.add(async () => {
|
||||
thread.postSystemMessage("Thread closed by user, closing...");
|
||||
await thread.close(true);
|
||||
suppressSystemMessages = true;
|
||||
});
|
||||
|
||||
closedBy = "the user";
|
||||
|
@ -133,7 +134,6 @@ module.exports = ({ bot, knex, config, commands }) => {
|
|||
}
|
||||
|
||||
// Regular close
|
||||
await thread.close(false, silentClose);
|
||||
closedBy = msg.author.username;
|
||||
}
|
||||
|
||||
|
@ -143,6 +143,8 @@ module.exports = ({ bot, knex, config, commands }) => {
|
|||
await thread.sendSystemMessageToUser(closeMessage).catch(() => {});
|
||||
}
|
||||
|
||||
await thread.close(suppressSystemMessages, silentClose);
|
||||
|
||||
await sendCloseNotification(thread, `Modmail thread with ${thread.user_name} (${thread.user_id}) was closed by ${closedBy}`);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue