Skip to content

Commit

Permalink
$index function
Browse files Browse the repository at this point in the history
  • Loading branch information
Faf4a committed Dec 28, 2023
1 parent 7e00558 commit b961a76
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/functions/misc/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = async (d) => {
const data = d.util.aoiFunc(d);
if (data.err) return d.error(data.err);

const i = d?.data.index;

if (!i && i !== 0) return d.aoiError.fnError(d, 'custom', {inside: data.inside}, 'No loop command.');

data.result = Number(i);

return {
code: d.util.setCode(data),
};
};
2 changes: 1 addition & 1 deletion src/functions/misc/loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = async d => {
for (let cmd of awaits) {
cmd = d.client.cmd.awaited.find(x => x.name.toLowerCase() === cmd.addBrackets().toLowerCase());

await d.interpreter(d.client, d.message, d.args, cmd, d.client.db, false, undefined, {...d.data, awaitData});
await d.interpreter(d.client, d.message, d.args, cmd, d.client.db, false, undefined, {...d.data, awaitData, index: i });
}
}

Expand Down

0 comments on commit b961a76

Please sign in to comment.