From ce82b7f1741619e4c6b019339e2c935b227ff316 Mon Sep 17 00:00:00 2001 From: ethann2004 <117716577+ethann2004@users.noreply.github.com> Date: Sun, 17 Sep 2023 23:51:25 -0700 Subject: [PATCH 1/3] Added support to disable mentions --- src/functions/event/interactionEdit.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/functions/event/interactionEdit.js b/src/functions/event/interactionEdit.js index e03e51517..bc78a2dd5 100644 --- a/src/functions/event/interactionEdit.js +++ b/src/functions/event/interactionEdit.js @@ -10,22 +10,21 @@ module.exports = async d => { files = await d.util.parsers.FileParser(files); - allowedMentions = allowedMentions === "all" ? ["everyone", "users", "roles"] : allowedMentions?.split(",") || []; + allowedMentions = allowedMentions === "all" ? [ "everyone", "users", "roles" ] : (allowedMentions ? allowedMentions?.split(",") : []); await d.data.interaction?.editReply({ - content: content.trim() === "" ? " " : content.addBrackets(), - embeds: embeds, - components: components, - files, - allowedMentions: { - parse: allowedMentions - } + content: content.trim() === "" ? " " : content.addBrackets(), + embeds: embeds, + components: components, + files, + allowedMentions: { + parse: allowedMentions } - ).catch(e => { + }).catch(e => { d.aoiError.fnError(d, 'custom', {}, 'Failed To Reply With Reason: ' + e) }); return { code: d.util.setCode(data) } -} \ No newline at end of file +} From 2a2f955ddf0ba21117bacf177222907589fdeb09 Mon Sep 17 00:00:00 2001 From: ethann2004 <117716577+ethann2004@users.noreply.github.com> Date: Sun, 17 Sep 2023 23:52:10 -0700 Subject: [PATCH 2/3] Added support to disable mentions --- src/functions/event/interactionReply.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/functions/event/interactionReply.js b/src/functions/event/interactionReply.js index 2fac80dc7..099eaf2a1 100644 --- a/src/functions/event/interactionReply.js +++ b/src/functions/event/interactionReply.js @@ -10,7 +10,7 @@ module.exports = async d => { files = await d.util.parsers.FileParser(files); - allowedMentions = allowedMentions === "all" ? [ "everyone", "users", "roles" ] : allowedMentions?.split( "," ) || []; + allowedMentions = allowedMentions === "all" ? [ "everyone", "users", "roles" ] : (allowedMentions ? allowedMentions?.split(",") : []); await d.data.interaction?.reply({ content: content.trim() === "" ? " " : content.addBrackets(), From 348990c412ecdd7d20708f5e63d0bba33c8e01d0 Mon Sep 17 00:00:00 2001 From: ethann2004 <117716577+ethann2004@users.noreply.github.com> Date: Sun, 17 Sep 2023 23:53:14 -0700 Subject: [PATCH 3/3] Added $hasAttachment --- src/functions/message/hasAttachment.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/functions/message/hasAttachment.js diff --git a/src/functions/message/hasAttachment.js b/src/functions/message/hasAttachment.js new file mode 100644 index 000000000..8304dc9a4 --- /dev/null +++ b/src/functions/message/hasAttachment.js @@ -0,0 +1,17 @@ +module.exports = async (d) => { + const data = d.util.aoiFunc(d); + + const [messageID = d.message?.id, channelID = d.channel?.id] = data.inside.splits; + + const channel = await d.util.getChannel(d, channelID); + if (!channel) return d.aoiError.fnError(d, 'channel', {inside: data.inside}); + + const message = await d.util.getMessage(channel, messageID); + if (!message) return d.aoiError.fnError(d, 'message', {inside: data.inside}); + + data.result = message.attachments.size ? true : false; + + return { + code: d.util.setCode(data) + } +}