sawex
October 23, 2022, 7:05am
1
HI
I’m trying to make new Dynamic command thanks for preveus help i make it like this, but i’m having a litle proplom
i think that because i put urlfetch inside pastebin. is there any other way to do that ?
pastebin:
{
"VALORANT": {
"Rank": "VALORANT :
Main $(eval X=JSON.parse(`$(urlfetch https://api.kyroskoh.xyz/valorant/v1/mmr/EU/LAW/00000?show=combo&display=0 ) /
Smurf $(eval Z=JSON.parse(`$(urlfetch https://api.kyroskoh.xyz/valorant/v1/mmr/EU/LAW/999?show=combo&display=0 )"
},
"Overwatch 2": {
"Rank": "Overwatch 2 : UnRanked (Placement 1 Win | 3 Lost)"
}
}```
Command :
$(eval p = $(urlfetch json https://pastebin.com/raw/TjXtTvCY); s = []; Object.values(p).forEach(k => s.push(k.Rank)); ${s.join(', ')}`; t = '$(twitch $(channel) "{{status}}|{{game}}")'.split('|'); t[0] === 'offline' ? f : p[t[1]] ? p[t[1]].Rank: f;)
Emily
October 24, 2022, 11:18am
2
Hey @sawex !
As mentioned a couple times before, you can’t directly use Nightbot variables inside a Pastebin:
Hey @steelboost !
If you want to use Nightbot variables values inside a Pastebin, you need to call them before entering the Pastebin as Nightbot reads that code but doesn’t replace the variables, it’s linked to how JS works.
So for your code, here’s how to do it, call the $(urlfetch) and define $(user) outside of the paste:
$(eval r=`$(urlfetch json http://tmi.twitch.tv/group/user/$(channel)/chatters)`; u=`$(user)`; $(urlfetch https://pastebin.com/raw/QNGztScQ))
And inside your paste QNGztScQ,…
The solution to your problem is to call both $(urlfetch)
in the command, and then call the Pastebin which will contain all the code.
First your command would look like this:
$(eval valorantMain = `$(urlfetch json https://api.kyroskoh.xyz/valorant/v1/mmr/EU/LAW/00000?show=combo&display=0)`; valorantSmurf = `$(urlfetch json https://api.kyroskoh.xyz/valorant/v1/mmr/EU/LAW/999?show=combo&display=0)`; t = '$(twitch $(channel) "{{status}}|{{game}}")'.split('|'); $(urlfetch https://pastebin.com/raw/XXXXXXXX))
And then your Pastebin like this:
const object = {
"VALORANT": {
"rank": `VALORANT : Main ${valorantMain} / Smurf ${valorantSmurf}`
},
"Overwatch 2": {
"rank": "Overwatch 2 : UnRanked (Placement 1 Win | 3 Lost)"
}
};
let s = [];
Object.values(object).forEach(k => s.push(k.rank));
const f = s.join(', ');
t[0] === 'offline' ? f : object[t[1]] ? object[t[1]].rank : f;
2 Likes
sawex
October 24, 2022, 8:27pm
3
Thank you so much
very appreciate your work
this one my mistake because i don’t know why i didn’t notice it on the search
1 Like
system
Closed
November 7, 2022, 8:27pm
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.