changed parseProxyTags to filter proxy differently. changed conditional in sendMessageAsMember because obj will never not exist

This commit is contained in:
Aster Fialla
2026-02-16 12:47:50 -05:00
parent 8b709b75ce
commit 07d4e735eb
2 changed files with 14 additions and 12 deletions

View File

@@ -52,7 +52,8 @@ msgh.parseProxyTags = async function (authorId, content, attachmentUrl= null){
}
const proxyMessage = {}
members.filter(member => member.proxy).forEach(member => {
members.forEach(member => {
if (member.proxy) {
const splitProxy = member.proxy.split("text");
if(content.startsWith(splitProxy[0]) && content.endsWith(splitProxy[1])) {
proxyMessage.member = member;
@@ -65,6 +66,7 @@ msgh.parseProxyTags = async function (authorId, content, attachmentUrl= null){
proxyMessage.message = content.replace(escapedPrefix, "").replace(escapedSuffix, "");
if (proxyMessage.message.length === 0) throw new Error(enums.err.NO_MESSAGE_SENT_WITH_PROXY);
}
}
})
return proxyMessage;
}

View File

@@ -17,7 +17,7 @@ wh.sendMessageAsMember = async function(client, message) {
const attachmentUrl = message.attachments.size > 0 ? message.attachments.first().url : null;
const proxyMatch = await messageHelper.parseProxyTags(message.author.id, message.content, attachmentUrl).catch(e =>{throw e});
// If the message doesn't match a proxy, just return.
if (!proxyMatch || !proxyMatch.member.proxy) {
if (!proxyMatch.member) {
return;
}
// If the message does match a proxy but is not in a guild server (ex: in the Bot's DMs