vfauth / kickstarter-reward-notifier

Be notified when limited Kickstarter rewards are available.
GNU General Public License v3.0
3 stars 2 forks source link

Fixed script not updating remaining rewards #2

Open Cliffback opened 2 years ago

Cliffback commented 2 years ago

Code didn't update rewards, it checked if rewards left was zero, but didn't update if it was not zero anymore. Added a for loop in the get mutable data section in getProjectData, where it compares the current saved number to the updated number of rewards left and updates it.

vfauth commented 1 year ago

If I understand correctly, couldn't you do the same thing but far more efficiently (instead of a loop on every watched reward inside of a loop on every parsed reward) by just dropping the reward["remaining"].(float64) == 0 in my condition?

Sorry to answer so late, I did not see the notification.

Cliffback commented 1 year ago

You're probably right! It was my first time with golang, and went for the the quickest and probably most dirty route, haha. Ended up with a Super Early Bird spot on a 3D printer kickstarter, so it did the trick. Your script saved me around $200 👍

I'll test and see if the result is the same

vfauth commented 1 year ago

Nice to see it helped somebody!! I never managed to gain anything until now :D

I will look into the logic during the holidays to check if it needs updating and how ;)

PS: If you pushed your real Telegram token, it will still be out in the Internet, there is no way to remove it now, so you should revoke it.