mirror of
https://github.com/pieartsy/PluralFlux.git
synced 2026-04-16 17:45:28 +10:00
adjusted webhook helper to not query twice for member.
adjusted proxy message to just reply to message w/ attachments with "Attachment sent by" instead of sending error message
This commit is contained in:
@@ -55,15 +55,14 @@ 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;
|
||||
proxyMessage.member = member;
|
||||
if (attachmentUrl) return proxyMessage.message = enums.misc.ATTACHMENT_SENT_BY;
|
||||
|
||||
let escapedPrefix = splitProxy[0].replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
let escapedSuffix = splitProxy[1].replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
console.log(escapedPrefix, escapedSuffix);
|
||||
escapedPrefix = new RegExp("^" + escapedPrefix);
|
||||
escapedSuffix = new RegExp(escapedSuffix + "$")
|
||||
proxyMessage.message = content.replace(escapedPrefix, "").replace(escapedSuffix, "");
|
||||
console.log(proxyMessage.message);
|
||||
if (proxyMessage.message.length === 0) throw new Error(enums.err.NO_MESSAGE_SENT_WITH_PROXY);
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user