dev
@frag.eth
Alright... time to write the script that calculates the Sunday raffle winners! ...will try to break it down slowly in the thread š§µ
4 replies
3 recasts
17 reactions
dev
@frag.eth
First of all... to view the raffle thread and all the entries I'm using @supercast because @warpcast hides some of the comments.
1 reply
1 recast
1 reaction
dev
@frag.eth
Then I inspect the DOM to find the list of entries and check that it matches the reply count (at the moment 508)
1 reply
1 recast
1 reaction
dev
@frag.eth
Getting a random entry is easy with the random node select script we've used before, but this time we need to add some extra entries for user who gave tips
1 reply
0 recast
0 reaction
dev
@frag.eth
Now the cast HTML structure is a bit funky on Supercast so to get the winner name we have to use a querySelector "a a + a a" and build the entry mapping with inital entries of 1 (the free entry)
1 reply
0 recast
0 reaction
dev
@frag.eth
To calculate the tips we need to find the cast message and we need to use another querySelector
1 reply
0 recast
0 reaction