From 49cab523f0029a2367738069352b9c5c9ed95748 Mon Sep 17 00:00:00 2001 From: Aster Fialla Date: Mon, 16 Feb 2026 00:11:11 -0500 Subject: [PATCH] removed ability to send attachments since i think fluxer deletes them from the server when a message is deleted :( --- src/enums.js | 3 ++- src/helpers/messageHelper.js | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/enums.js b/src/enums.js index cfc0f7d..f95aefe 100644 --- a/src/enums.js +++ b/src/enums.js @@ -19,7 +19,8 @@ helperEnums.err = { 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.', - IMPORT_ERROR: "Please see attached file for logs on the member import process." + IMPORT_ERROR: "Please see attached file for logs on the member import process.", + ATTACHMENTS_NOT_ALLOWED: "Unfortunately proxied message attachments aren't possible at this time. If you want to send a file, you can use a file host instead of uploading directly." } helperEnums.help = { diff --git a/src/helpers/messageHelper.js b/src/helpers/messageHelper.js index 3cbfc55..3e072c2 100644 --- a/src/helpers/messageHelper.js +++ b/src/helpers/messageHelper.js @@ -55,24 +55,25 @@ msgh.parseProxyTags = async function (authorId, content, attachmentUrl= null){ members.filter(member => member.proxy).forEach(member => { const splitProxy = member.proxy.split("text"); if(content.startsWith(splitProxy[0]) && content.endsWith(splitProxy[1])) { + if (attachmentUrl) throw new Error(enums.err.ATTACHMENTS_NOT_ALLOWED); proxyMessage.proxy = member.proxy; const removePrefix = new RegExp("^" + splitProxy[0]); const removeSuffix = new RegExp(splitProxy[1] + "$"); - proxyMessage.message = content.replace(removePrefix, "").replace(removeSuffix, ""); - - if (proxyMessage.message.length === 0 && !attachmentUrl) throw new Error(enums.err.NO_MESSAGE_SENT_WITH_PROXY); + proxyMessage.message = content.replace(removePrefix, "").replace(removeSuffix, "");; + if (proxyMessage.message.length === 0) throw new Error(enums.err.NO_MESSAGE_SENT_WITH_PROXY); } }) return proxyMessage; } /** - * Sends a message as an attachment if it's too long. + * Sends a message as an attachment if it's too long.NOT CURRENTLY IN USE * * @async * @param {string} text - The text of the message. * @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) { if (text.length > 2000) {