Skip to content

Commit

Permalink
Merge pull request #486 from ethann2004/v6
Browse files Browse the repository at this point in the history
$hasAttachment and Disable Mentions
  • Loading branch information
Leref authored Oct 7, 2023
2 parents 1b9f946 + 348990c commit 3ce2971
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
19 changes: 9 additions & 10 deletions src/functions/event/interactionEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
2 changes: 1 addition & 1 deletion src/functions/event/interactionReply.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
17 changes: 17 additions & 0 deletions src/functions/message/hasAttachment.js
Original file line number Diff line number Diff line change
@@ -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)
}
}

0 comments on commit 3ce2971

Please sign in to comment.