Skip to content

Commit

Permalink
feat: returnid
Browse files Browse the repository at this point in the history
  • Loading branch information
Faf4a committed Dec 23, 2023
1 parent 5a2d9f9 commit 5c269ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/functions/event/interactionFollowUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ module.exports = async d => {
const data = d.util.aoiFunc(d);
if (data.err) return d.error(data.err);

let [content = "", embeds = "", components = "", files = "", ephemeral = "false"] = data.inside.splits
let [content = "", embeds = "", components = "", files = "", ephemeral = "false", returnId = "false"] = data.inside.splits

embeds = await d.util.parsers.EmbedParser(embeds, d);

components = await d.util.parsers.ComponentParser(components, d);

files = await d.util.parsers.FileParser(files, d);

await d.data.interaction?.followUp({
const interaction = await d.data.interaction?.followUp({
content: content.trim() === "" ? " " : content.addBrackets(),
embeds: embeds,
components: components,
Expand All @@ -20,6 +20,8 @@ module.exports = async d => {
d.aoiError.fnError(d, 'custom', {}, 'Failed To Reply With Reason: ' + e)
})

if (returnId === "true") data.result = interaction?.id ?? undefined;

return {
code: d.util.setCode(data)
}
Expand Down
4 changes: 3 additions & 1 deletion src/functions/event/interactionReply.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = async d => {
const data = d.util.aoiFunc(d);
if (data.err) return d.error(data.err);

let [content = "", embeds = "", components = "", files = "", allowedMentions = "all", ephemeral = "false"] = data.inside.splits
let [content = "", embeds = "", components = "", files = "", allowedMentions = "all", ephemeral = "false", returnId = "false"] = data.inside.splits

embeds = await d.util.parsers.EmbedParser(embeds, d);

Expand All @@ -23,6 +23,8 @@ module.exports = async d => {
ephemeral: ephemeral === "true" || ephemeral === "true"
})

if (returnId === "true") data.result = (await d.data.interaction?.fetchReply())?.id ?? undefined;

return {
code: d.util.setCode(data)
}
Expand Down

0 comments on commit 5c269ca

Please sign in to comment.