Urlfetch inside pastebin

Hey @sawex!

As mentioned a couple times before, you can’t directly use Nightbot variables inside a Pastebin:

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