Right-Hand side of instanced of is not an object

Trying to get nightbot to respond with my match details in Aoe2. Brand new to this and need some help.

This is what I am using

$(eval if(typeof($(1))==“object”&&!$(1)){try{r=$(urlfetch json https://aoe2.net/leaderboard/aoe2de/rm-1v1?search[value]=Bartender);%7Dcatch(e)%7B%27No response’}for(var i=0;i<r[‘data’].length;i++){ if(r[‘data’][i][0] == ‘561694198’){ break; }}}else{i=0;r=$(urlfetch json https://aoe2.net/leaderboard/aoe2de/rm-1v1?search[value]=$(querystring));%7Dtry%7Br[%27data%27][i][5].concat(%27/%27s Rank: #’,r[‘data’][i][1],’ with ‘,r[‘data’][i][2],’ points’);}catch(e){‘User not found’})

I am getting this is a response.

Right-hand side of ‘instanceof’ is not an object

Anyone know what the issue is with this string of code?

Hey @Bartender!

What data are you trying to get out of this API?

Because they give an example of a command to get match details and this isn’t what you’ve used here.
This one gives your last or current Match details: https://aoe2.net/api/nightbot/match?search=Bartender

Trying to get nightbot to respond with my match details in Aoe2.

The one you use gives your position on the Random Map 1v1 Leaderboard: https://aoe2.net/leaderboard/aoe2de/rm-1v1?search[value]=Bartender
But there’s a simpler way: https://aoe2.net/api/nightbot/rank?search=Bartender&flag=false
This is not the same thing.

I suggest you to read the Nightbot section of their API and tell us what you want exactly from it.


Now regarding your command, from what I understand you want it to default to your profile, unless someone request their data, have I got that right?

I’m trying to get mirror what many have as a !match command. This would show who is playing in the match which civs and what their rating is. I have the rating one working showing my position on the leaderboard.

You have to help me there because I don’t know anything about this game, nor what most people have as a !match command. I think the first link in my previous post is the one you’re looking for, but I can’t be sure, that’s why I asked you to read the Nightbot section of their API (last link of my previous post) if the first link I provided isn’t the right one, then I will be able to improve the command if that’s what you’re looking for.

You were totally right and it worked perfectly. Thanks for the help!

Awesome, glad to hear! Pleasure is mine!

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