Fix error when sending system messages to the user

master
Dragory 2020-05-25 11:52:31 +03:00
parent 200b236c75
commit c76d422768
No known key found for this signature in database
GPG Key ID: 5F387BA66DF8AAC1
2 changed files with 4 additions and 4 deletions

View File

@ -178,7 +178,7 @@ async function createNewThreadForUser(user, quiet = false, ignoreRequirements =
const responseMessage = utils.readMultilineConfigValue(config.responseMessage); const responseMessage = utils.readMultilineConfigValue(config.responseMessage);
try { try {
await newThread.postToUser(responseMessage); await newThread.sendSystemMessageToUser(responseMessage);
} catch (err) { } catch (err) {
responseMessageError = err; responseMessageError = err;
} }

View File

@ -13,7 +13,7 @@ module.exports = ({ bot, knex, config, commands }) => {
for (const thread of threadsToBeClosed) { for (const thread of threadsToBeClosed) {
if (config.closeMessage && ! thread.scheduled_close_silent) { if (config.closeMessage && ! thread.scheduled_close_silent) {
const closeMessage = utils.readMultilineConfigValue(config.closeMessage); const closeMessage = utils.readMultilineConfigValue(config.closeMessage);
await thread.postToUser(closeMessage).catch(() => {}); await thread.sendSystemMessageToUser(closeMessage).catch(() => {});
} }
await thread.close(false, thread.scheduled_close_silent); await thread.close(false, thread.scheduled_close_silent);
@ -118,7 +118,7 @@ module.exports = ({ bot, knex, config, commands }) => {
// Send close message (unless suppressed with a silent close) // Send close message (unless suppressed with a silent close)
if (hasCloseMessage && ! silentClose) { if (hasCloseMessage && ! silentClose) {
const closeMessage = utils.readMultilineConfigValue(config.closeMessage); const closeMessage = utils.readMultilineConfigValue(config.closeMessage);
await thread.postToUser(closeMessage).catch(() => {}); await thread.sendSystemMessageToUser(closeMessage).catch(() => {});
} }
const logUrl = await thread.getLogUrl(); const logUrl = await thread.getLogUrl();
@ -139,7 +139,7 @@ module.exports = ({ bot, knex, config, commands }) => {
console.log(`[INFO] Auto-closing thread with ${thread.user_name} because the channel was deleted`); console.log(`[INFO] Auto-closing thread with ${thread.user_name} because the channel was deleted`);
if (config.closeMessage) { if (config.closeMessage) {
const closeMessage = utils.readMultilineConfigValue(config.closeMessage); const closeMessage = utils.readMultilineConfigValue(config.closeMessage);
await thread.postToUser(closeMessage).catch(() => {}); await thread.sendSystemMessageToUser(closeMessage).catch(() => {});
} }
await thread.close(true); await thread.close(true);