simplified sendMessageAsAttachment

This commit is contained in:
Aster Fialla
2026-02-18 00:26:43 -05:00
parent 1bf6c8c1f2
commit 23a57b3e99

View File

@@ -72,23 +72,17 @@ msgh.parseProxyTags = async function (authorId, content, attachmentUrl= null){
} }
/** /**
* Sends a message as an attachment if it's too long.NOT CURRENTLY IN USE * Sends a message as an attachment if it's too long.
* *
* @async * @async
* @param {string} text - The text of the message. * @param {string} text - The text of the message.
* @param {Message} message - The message object. * @param {Message} message - The message object.
* @throws {Error} If a proxy message is sent with no message within it.
* *
*/ */
msgh.sendMessageAsAttachment = async function(text, message) { msgh.sendMessageAsAttachment = async function (text, message) {
if (text.length > 2000) { if (text.length > 2000) {
tmp.file(async (err, path, fd, cleanupCallback) => { const data = Buffer.from(text, 'utf-8');
fs.writeFile(path, text, (err) => { await message.reply({content: enums.err.IMPORT_ERROR, files: [{name: 'import-logs.txt', data}]});
if (err) throw err;
})
if (err) throw err;
await message.reply({content: enums.err.IMPORT_ERROR, attachments: [path]});
});
} }
} }