I’m trying to create a command that returns the overall number of wins in Fortnite.
Is it possible to evaluate (to sum) the wins from different platforms?
For example:
But problem is that inserted url returns text and number of wins… Any ideas how to write the proper command?
I could use $(eval x+x) but the problem is the same
Thank you for your help!
!addcom -cd=5 !wins $(eval try{`$(urlfetch https://2g.be...)$(urlfetch https://2g.be...)`.match(/Wins: [0-9]+/g).map(a=>parseInt(a.split(` `)[1])).reduce((a,b)=>a+b);}catch(e){`Could not calculate the total wins!`;})
In the above command setup, you will see this string:
@RokettoJanpu
You’re a pure god! IT WORKS
You just wrote ‘Kills:’ instead of ‘Wins:’ … anyway thank you for your help! Here is a full code if anyone has this problem as well:
!addcom -cd=5 !wins NAME’s wins: $(eval try{$(urlfetch https://2g.be/...)$(urlfetch https://2g.be/...).match(/Wins: [0-9]+/g).map(a=>parseInt(a.split()[1])).reduce((a,b)=>a+b);}catch(e){Could not calculate the total wins!;})