mirror of
https://github.com/pieartsy/PluralFlux.git
synced 2026-04-14 20:15:28 +10:00
hopefully ACTUALLY writes and sends file now...
This commit is contained in:
@@ -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 = {
|
||||
|
||||
@@ -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]});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user