Charity Counter

Warning I’m really new to this. I spent the day looking through threads trying to figure out if what I am doing is possible.

A streamer has a charity goal, which is being updated on the fly as donations are made. We wanted to have a counter to measure how much they need each day to hit the goal. This should change as the amount donated increases and the number of days decrease. For instance if the goal is 1000 and there are 100 days left then the command would return $10.00.

I got this

$(eval daysleft=((( new Date(‘2025-05-01’)-Date.now())/86400000+1)10)/10;rnddl= Math.round(daysleft1)/1;Dollarleft = ‘$’+ Math.round(((1000-91)/rnddl)*100)/100;)

which works. It calculates the numbers of days left (including today) and figures out what the daily goal is if the total to be raised is 1000 and the current amount raised is 91 dollars.

The issue is every time someone donates mid stream a mod would have to go in and update this command from 91 to whatever the new total donated is. THe streamer has a command that pulls from pastebin the current amount raised and there is some method being used to update that…

$(urlfetch https://pastebin.com/raw/XxXxxX8f)

I wanted to combine these two so that one command would not only do the calculation but use the value pulled from pastebin. I wrote this

$(eval amtleft=$(urlfetch https://pastebin.com/raw/RfZPcs8E); daysleft=((( new Date(‘2025-05-01’)-Date.now())/86400000+1)10)/10;rnddl= Math.round(daysleft1)/1;Dollarleft = ‘$’+ Math.round((50000-amtleft/rnddl)*100)/100;)

but obviously it’s wrong because it returns $91 is not defined.

It’s pulling the right number from the pastebin but it’s not performing the calculations. thoughts?

you can fix your compilation error with the following fixes, but i can’t vouch for its correctness in calculations:

$(eval let amtleft=`$(urlfetch https://pastebin.com/raw/RfZPcs8E)`.replace(/[\$\,]/g,''); let daysleft=(((new Date('2025-05-01')-Date.now())/86400000+1)*10)/10; let rnddl=Math.round(daysleft*1)/1; let Dollarleft = ‘$’+ Math.round((50000-amtleft/rnddl)*100)/100;)

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