hopefully ACTUALLY writes and sends file now...

This commit is contained in:
Aster Fialla
2026-02-15 23:18:29 -05:00
parent fa86606fb4
commit e1dbba9043
2 changed files with 7 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
import {memberHelper} from "./memberHelper.js";
import {enums} from "../enums.js";
import tmp from "tmp";
import tmp, {setGracefulCleanup} from "tmp";
import fs from 'fs';
import {Message} from "@fluxerjs/core";
@@ -8,6 +8,8 @@ const msgh = {};
msgh.prefix = "pf;"
setGracefulCleanup();
/**
* Parses and slices up message arguments, retaining quoted strings.
*
@@ -75,11 +77,11 @@ msgh.parseProxyTags = async function (authorId, content, attachmentUrl= null){
msgh.sendMessageAsAttachment = async function(text, message) {
if (text.length > 2000) {
tmp.file(async (err, path, fd, cleanupCallback) => {
fs.writeFile('path', text, (err) => {
fs.writeFile(path, text, (err) => {
if (err) throw err;
})
if (err) throw err;
await message.reply({attachments: [path]});
await message.reply({content: enums.err.IMPORT_ERROR, attachments: [path]});
});
}
}