mirror of
https://github.com/pieartsy/PluralFlux.git
synced 2026-04-16 17:45:28 +10:00
simplified sendMessageAsAttachment
This commit is contained in:
@@ -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]});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user