Fix crash if the close message failed to send when closing a thread
parent
ff977b3eea
commit
7e7bd03798
|
@ -14,7 +14,7 @@ module.exports = bot => {
|
|||
async function applyScheduledCloses() {
|
||||
const threadsToBeClosed = await threads.getThreadsThatShouldBeClosed();
|
||||
for (const thread of threadsToBeClosed) {
|
||||
if(config.closeMessage) await thread.postToUser(config.closeMessage);
|
||||
if(config.closeMessage) await thread.postToUser(config.closeMessage).catch(() => {});
|
||||
await thread.close();
|
||||
|
||||
const logUrl = await thread.getLogUrl();
|
||||
|
@ -68,7 +68,7 @@ module.exports = bot => {
|
|||
}
|
||||
|
||||
// Regular close
|
||||
if(config.closeMessage) await thread.postToUser(config.closeMessage);
|
||||
if(config.closeMessage) await thread.postToUser(config.closeMessage).catch(() => {});
|
||||
await thread.close();
|
||||
|
||||
const logUrl = await thread.getLogUrl();
|
||||
|
@ -86,7 +86,7 @@ module.exports = bot => {
|
|||
if (! thread) return;
|
||||
|
||||
console.log(`[INFO] Auto-closing thread with ${thread.user_name} because the channel was deleted`);
|
||||
if(config.closeMessage) await thread.postToUser(config.closeMessage);
|
||||
if(config.closeMessage) await thread.postToUser(config.closeMessage).catch(() => {});
|
||||
await thread.close(true);
|
||||
|
||||
const logUrl = await thread.getLogUrl();
|
||||
|
|
Loading…
Reference in New Issue