Skip to content

Commit

Permalink
Revised changes
Browse files Browse the repository at this point in the history
  • Loading branch information
supremesupreme committed Oct 5, 2024
1 parent 87e81e6 commit e67f618
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
20 changes: 7 additions & 13 deletions src/functions/ForEachObjectArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,19 @@ module.exports = async (d) => {
return d.aoiError.fnError(d, "custom", { inside: data.inside }, "Awaited Command With Name '" + awaitedCmd + "' Does Not Exist.");
}

let parsedData = {};
for (const key in d.data.objects[name]) {
if (Array.isArray(d.data.objects[name][key])) {
parsedData[key] = d.data.objects[name][key]
}
}

let el = {};
let i = 0;
for (const key in d.data.objects[name]) {
if (d.data.objects[name].hasOwnProperty(key)) {
const el = d.data.objects[name][key];

el[key] = d.data.objects[name][key];
const c = { ...cmd };
c.code = c.code.replaceAll("{value}", el);

if(Array.isArray(el)){
let parsedResult = JSON.stringify(parsedData[property][i])
const result = await Interpreter(
if(!Array.isArray(el[key])) continue;
el[key] = d.data.objects[name][key]
let parsedResult = JSON.stringify(el[property][i])
await Interpreter(
d.client,
d.message,
d.args,
Expand All @@ -50,7 +45,6 @@ module.exports = async (d) => {
{ ...d.data, awaitData: parsedResult, index: i }
);
i++;
}
}
}

Expand Down
9 changes: 6 additions & 3 deletions src/functions/awaitData.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ module.exports = (d) => {
const [option] = data.inside.splits;

try {
data.result = eval(`d.data.awaitData?.${option.addBrackets()}`);
} finally{
data.result = eval(`d.data.awaitData`);
if(option){
data.result = eval(`d.data.awaitData?.${option}`);
} else {
data.result = eval(`d.data.awaitData`);
}
} catch (e){
}
return {
code: d.util.setCode(data),
Expand Down

0 comments on commit e67f618

Please sign in to comment.