removed some overzealous error handling

This commit is contained in:
Aster Fialla
2026-02-15 16:48:22 -05:00
parent 75dba413b8
commit 8f70960079
3 changed files with 3 additions and 5 deletions

View File

@@ -414,9 +414,6 @@ mh.getMembersByAuthor = async function(authorId) {
* @throws {Error} When an empty proxy was provided, or no proxy exists.
*/
mh.checkIfProxyExists = async function(authorId, proxy) {
const trimmedProxy = proxy ? proxy.trim() : null;
if (trimmedProxy == null) throw new RangeError(`Proxy ${enums.err.NO_VALUE}`);
const splitProxy = proxy.trim().split("text");
if(splitProxy.length < 2) throw new Error(enums.err.NO_TEXT_FOR_PROXY);
if(!splitProxy[0] && !splitProxy[1]) throw new Error(enums.err.NO_PROXY_WRAPPER);

View File

@@ -55,7 +55,8 @@ msgh.parseProxyTags = async function (authorId, attachment, content){
const removePrefix = new RegExp("^" + splitProxy[0]);
const removeSuffix = new RegExp(splitProxy[1] + "$");
proxyMessage.message = content.replace(removePrefix, "").replace(removeSuffix, "");
if (proxyMessage.message.length <= splitProxy[0].length + splitProxy[1].length && !attachment) throw new Error(enums.err.NO_MESSAGE_SENT_WITH_PROXY);
if (proxyMessage.message.length === 0 && !attachment) throw new Error(enums.err.NO_MESSAGE_SENT_WITH_PROXY);
}
})
return proxyMessage;

View File

@@ -17,7 +17,7 @@ const name = 'PluralFlux Proxy Webhook';
wh.sendMessageAsMember = async function(client, message, content) {
const proxyMatch = await messageHelper.parseProxyTags(message.author.id, message.attachments[0] ?? null, content).catch(e =>{throw e});
// If the message doesn't match a proxy, just return.
if (!proxyMatch.proxy) {
if (!proxyMatch || !proxyMatch.proxy) {
return;
}
// If the message does match a proxy but is in a guild server