I spent the last weekend re-writing my voting BOT. It’s a thankless task, and I have been putting it off for months. When I get my Python hat on, I roll, but it's tough finding that headwear sometimes.
There are more interesting things to do like playing Assassin's Creed Odyssey or re-playing it. Wasted time, it surely is and after a 4 hour session I feel so guilty for not having achieved anything.
...'hunting down Mercenaries and Cultists is surely more fun than this?'... - Source
Gaining TWO levels does not count, as this is strictly escapism in the finest sense, though entertaining.
So I wasted two days, re-writing my abortion of a legacy script that works very well but looks fucking awful. ‘BEEM the deprecated', it had to go and nearly has.
The idea of showing some deserving UK Hivers love, due to @c0ff33a's old @teamuksupport ceasing to be sounded great, but this was not my idea.
@livingktaiwan asked me if I could convert my old BOT, and suddenly that elusive Python hat appeared in front of my eyes as if by magic.
...'thanks @steevc, these lists of yours came in very handy'...
@steevc’s large list of UK people helped me out and I have to say a big thanks to @livingktaiwan for supplying me the data formatted in a list.
After a very productive Saturday and an equally unproductive Sunday, the BOT was ready for its first run-through and crashed spectacularly.
It’s my fault for naming it v1.0. It should have been at least v1.1 for as everyone knows v.1.0 of anything does not work.
Running scripts against lists always surprises me with the data it feeds out. It's one of the joys of being able to code; to see that 'thing' you are developing spring into life.
There are still some bugs in it, but it's kind of working though hardly draining my voting power.
...'a common sight, hardly anyone posts content on HIVE, at least from the UK'...
There's barely anyone posting and a single run-through didn't quite achieve what I was looking for.
My old BOT relied heavily on BEEM and Saturday was bliss, with not a BEEM Import on the horizon.
Then Sunday arrived, the BOT was 90% done and that last 10% was going to give me some shit. I wanted to use the Condenser API calls and had found functions for almost everything except a couple of pertinent ones.
- get_voting_power
I had used BEEM previously and try as I may, I could not get a condenser function to return the correct values. After fucking around for a couple of hours I caved in and added the BEEM library.
# -----------------------------------------------------------------------------
# Function to get the voting power of an account using fucking BEEM :(
def get_voting_power(voter):
try:
account = Account(voter, blockchain_instance=hive)
vp = round(account.get_voting_power(), 2) # Convert to percentage
return vp
except Exception as e:
print(f"Error retrieving voting power for @{voter}: {e}")
return None
# -----------------------------------------------------------------------------
As you can see, I was far from happy but I wanted the new toy to be finished by the end of the weekend. I knew once my coding head was off the rails, it would be tough for me to re-attach.
- vote
This was puzzling, there must be a way to vote using clear-text credential posting keys. Yet again, I could not find a way to do it, nothing was working and Sunday afternoon was turning into dusk.
# -------------------------------------------------------------------------------
def vote(post, author, ivoteweight, voter, lasestpost):
print()
if hasAuthorVoted(voter, author, lasestpost):
print (bcolors.RED + f" Post has already been voted by @{voter}, skipping..." + bcolors.END)
return
else:
print(bcolors.YELLOW + f" Post has NOT previously been voted by @{voter}..." + bcolors.END)
print(bcolors.YELLOW + f' Post will be voted at {ivoteweight:.2f}%' + bcolors.END)
if not debugmode:
post.upvote(weight=ivoteweight, voter=voter)
print()
print(bcolors.GREEN + " STATUS: Success!!!"+ bcolors.END)
return
# -------------------------------------------------------------------------------
'lasestpost'- I was getting tired, but spelling mistake or not, it would work!
BEEM again to the rescue, and thanks @felixxx for helping me out converting a permalink string to a BEEM comment.
The documentation may seem extensive for this ageing library but as all my other functions DON'T use BEEM, the permalinks I had were not BEEM comments, and I needed them to be in that specific format for the vote function to work.
# ---------------------------------------------------------------------------
def permalink_to_beem_comment(permalink):
hive = Hive(node = activenode)
post = Comment(permalink, hive_instance=hive)
return post
# ---------------------------------------------------------------------------
It's easy enough so long as you have a definition within activenode, otherwise, you get a 'String Indices’ error that tells you nothing. Luckily I have friends who know the idiosyncrasies of this library.
So… for the moment:
activenode = "https://api.deathwing.me"
Thanks @deathwing, I find your node particularly reliable and you have a cool name, so I used you.
As for the BOT and who it’s going to vote that will remain a secret. If you are from the UK or are an ex-patriot I will know about you via @steevc's list, so maybe not so secret.
I want to thank several other Orca's (who will remain nameless) who have thrown in and, supported this BOT by following a specific account that triggers further votes.
...'Orca Support - don't expect $$, but it's better than nothing'... - Source
If it was just @livingktaiwan and me it would have been decent but having that handful of other voters makes it more significant.
Please don’t ask to be added to the list, if you are deserving and from the UK then I will seek you out and give you support.
Lastly, I will give big comment votes out to anyone who can replace these fucking BEEM functions with working Condenser ones!
Do you like posting your Urbex content and photography for FREE on Facebook and YouTube? I like to get some form of reward for my work and every time I create I do just that. Take a look at The Urbex Community on HIVE.
If you want to keep creating for FREE then ignore what you are reading. If you want to be like me and gain something other than BUGGER ALL for your work then click here and learn about posting on the HIVE blockchain.
My Urban Exploration Tales can be found directly on the internet via my
Website: 'Tales of the Urban Explorer'.
If you found this article so invigorating that you are now a positively googly-eyed, drooling lunatic with dripping saliva or even if you liked it just a bit, then please upvote, comment, rehive, engage me or all of these things.