Add more safeguards when using Thread#_postToThreadChannel()
parent
662c6b0c21
commit
ec3a2455e0
|
@ -210,7 +210,7 @@ class Thread {
|
|||
// Show the reply in the inbox thread
|
||||
const inboxContent = formatters.formatStaffReplyThreadMessage(moderator, text, threadMessage.message_number, { isAnonymous });
|
||||
const inboxMessage = await this._postToThreadChannel(inboxContent, files);
|
||||
await this._updateThreadMessage(threadMessage.id, { inbox_message_id: inboxMessage.id });
|
||||
if (inboxMessage) await this._updateThreadMessage(threadMessage.id, { inbox_message_id: inboxMessage.id });
|
||||
|
||||
// Interrupt scheduled closing, if in progress
|
||||
if (this.scheduled_close_at) {
|
||||
|
@ -288,8 +288,9 @@ class Thread {
|
|||
* @param {*} args
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async postSystemMessage(content, ...args) {
|
||||
const msg = await this._postToThreadChannel(content, ...args);
|
||||
async postSystemMessage(content, file = null) {
|
||||
const msg = await this._postToThreadChannel(content, file);
|
||||
if (msg) {
|
||||
await this._addThreadMessageToDB({
|
||||
message_type: THREAD_MESSAGE_TYPE.SYSTEM,
|
||||
user_id: null,
|
||||
|
@ -299,6 +300,7 @@ class Thread {
|
|||
dm_message_id: msg.id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string|Eris.MessageContent} content
|
||||
|
|
Loading…
Reference in New Issue