$(query) not working in nested eval

so basically im trying to make custom command that will get the youtube vid id and trigger urlfetch and include the id into the url

this is the code
somehow the $(query) result will give as $(query), not the value given by chat
$(eval
const api = $(urlfetch
json https://6f1c-60-50-144-78.ngrok.io/api/drum-request/$(userid)/$(user)/$(eval
regExp = /^.((youtu.be/)|(v/)|(/u/\w/)|(embed/)|(watch?))??v?=?([^#&?]).*/;
url = “$(query)”;
match = url.match(regExp);
$id = (match&&match[7].length==11)? match[7] : false;
$id
)
);
api[0]
)

if i were to try getting the youtube vid id on its own, it would works as normal
$(eval
regExp = /^.((youtu.be/)|(v/)|(/u/\w/)|(embed/)|(watch?))??v?=?([^#&?]).*/;
url = “$(query)”;
match = url.match(regExp);
$id = (match&&match[7].length==11)? match[7] : false;
$id
)

Hey @uzumakininde!

I can’t read this code, this is asking too much efforts from me.
Thankfully you formatted it properly on the Discord, so I can tell you what the issue is: you went over the nesting limit, you need to rewrite your code so you don’t exceed two levels.

Here’s three topics that could help:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.