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

@@ -18,7 +18,8 @@ helperEnums.err = {
NO_TEXT_FOR_PROXY: "You need the word 'text' for the bot to detect proxy tags with.\nCorrect usage examples: `pf;member jane proxy J:text`, `pf;member jane [text]`",
NO_PROXY_WRAPPER: "You need at least one proxy tag surrounding 'text', either before or after.\nCorrect usage examples: `pf;member jane proxy J:text`, `pf;member jane [text]`",
NOT_JSON_FILE: "Please attach a valid JSON file.",
NO_MEMBERS_IMPORTED: 'No members were imported.'
NO_MEMBERS_IMPORTED: 'No members were imported.',
IMPORT_ERROR: "Please see attached file for logs on the member import process."
}
helperEnums.help = {

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]});
});
}
}