Valorant win/loss during stream uptime

Hello I want to create a custom command that will return a users win and loss ratio with amount of rr gained/loss during the length of a stream.

I currently have the following

$(eval a = parseInt($(twitch $(channel) {{uptimeLength}}));m = ‘$(urlfetch json https://api.henrikdev.xyz/valorant/v1/lifetime/mmr-history/NA/butter/pop)’;r = JSON.parse(m);m = 0; w = 0; l = 0; c = new Date();for (i = 0; i < r.data.length; i++) {d = new Date(r.data[i].date); c.setMinutes(c.getMinutes() - a); p = r.data[i].last_mmr_change; if (d < c) {break;} p > 0 ? w += 1 : l += 1; m += p; } He's ${m} ${w}-${l}:wink:

However, this seems to add all the game history rather than the ones after the stream start date/time. Any help would be appreciated thank you

I was able to fix this

For anyone encountering a problem like this my current command is setup like this

$(eval a = `$(twitch $(channel) "{{uptimeLength}}")`; a.includes("hour")?a = parseInt(a)*60+59:a = parseInt(a);m='$(urlfetch json https://api.henrikdev.xyz/valorant/v1/lifetime/mmr-history/NA/butter/pop)';r = JSON.parse(m);m = 0; w = 0; l = 0; c = new Date(); c.setMinutes(c.getMinutes() - a); for (i = 0; i < r.data.length; i++) {d = new Date(r.data[i].date); p = r.data[i].last_mmr_change; if (d < c) {break;} p > 0 ? w += 1 : l += 1; m += p; } `${m >= 0 ? `Up ${m}` : `Down ${m}`}RR ${w}-${l}`;)
3 Likes

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