Skip to content

Commit

Permalink
feat(getSelectMenuValues[]): returns select menu values
Browse files Browse the repository at this point in the history
  • Loading branch information
Faf4a committed Feb 24, 2024
1 parent 4225052 commit b80bd6a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/functions/interaction/getSelectMenuValues.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = async (d) => {
const data = d.util.aoiFunc(d);

const [ value = "1", sep = "," ] = data.inside.splits;

let interaction = d.data?.interaction

if (!interaction) return d.aoiError.fnError(d, "custom", { inside: data.inside }, "interaction");

if (value.toLowerCase() === "all") {
data.result = d.data.interaction.values.join(sep);
} else {
if (isNaN(Number(value)) || Number(value - 1) < 0) return d.aoiError.fnError(d, "custom", { inside: data.inside }, "number");

data.result = interaction.values[Number(value - 1)]
}

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

0 comments on commit b80bd6a

Please sign in to comment.