u
This commit is contained in:
@@ -966,16 +966,14 @@ const actions = {
|
||||
* @param {object[]} [maybeAttachments]
|
||||
*/
|
||||
async sendMessage(textOrPayload, maybeAttachments = []) {
|
||||
let trimmed = '';
|
||||
let fileAttachments = [];
|
||||
|
||||
if (typeof textOrPayload === 'object' && textOrPayload !== null) {
|
||||
trimmed = (textOrPayload.text || '').trim();
|
||||
fileAttachments = Array.isArray(textOrPayload.attachments) ? textOrPayload.attachments : [];
|
||||
} else {
|
||||
trimmed = (textOrPayload || '').trim();
|
||||
fileAttachments = Array.isArray(maybeAttachments) ? maybeAttachments : [];
|
||||
}
|
||||
const trimmed =
|
||||
typeof textOrPayload === 'object' && textOrPayload !== null
|
||||
? (textOrPayload.text || '').trim()
|
||||
: (textOrPayload || '').trim();
|
||||
const fileAttachments =
|
||||
typeof textOrPayload === 'object' && textOrPayload !== null
|
||||
? (Array.isArray(textOrPayload.attachments) ? textOrPayload.attachments : [])
|
||||
: (Array.isArray(maybeAttachments) ? maybeAttachments : []);
|
||||
|
||||
if (!trimmed && fileAttachments.length === 0) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user