Found some coding time
Image created with deepai.org
Code overhaul
When I started developing a Hive bot I had almost no Python knowledge or any idea how read/write to the Hive blockchain. The over three years old pizza bot code was my only guideline to somehow get started.
Today, @hug.bot and @sloth.buzz moved to a new code. The configuration is now completely in a sqlite3 database. The bot itself moved from procedural to object oriented design. This makes the implementation of additional features much easier.
With the configuration parameters being read from a database as needed, the bots behaviour can now be altered while it is running.
On top I spent a lot of time (hopefully) improving exception handling when it comes to connection issues. During that process I also eliminated a few bugs that were hiding in the background. Luckily they did not cause any damage or larger issues, which explains how they were able to hide until now.
New Features
- The tipper can now also receive some tokens. Both values can be configured separately.
- The tip can now be staked to the receiving account
- The vote is now based on the receiver's token balance/stake
- The vote is now balanced to a baseline of the available mana. Nutshell: less mana - lower vote weight
All these features can be configured and/or turned on/off in the options.
Relevant Bugfixes
- Improved exception handling.
- Check if a post/comment has already been voted on before trying to cast a vote now works.
I bet I forgot one or two features or bugfixes. The last few days I spent a lot of small chunks of time with the code, fiddling a few lines here and there to either bring them up to styling or coding standard.
For the Future
Two weeks since introducing a more extensive data collection are almost over. The plan was to now start developing the evaluation of that data. Python has some nice libs to turn those statistics into diagrams. This way I extend my Python knowledge and I can try out the image uploader in the beem library.
With the configuration (and status) being live in a database I can now also start developing a real discord bot to query and alter that data. Already had a glance into that topic and it looks pretty exciting.
Thoughts and suggestions?
As always I am looking forward to your thoughts and suggestions. Is there any feature you would like the bot to have? Please leave a comment if you have any ideas. Thank you very much.
As a sloth Hannes does not post that much but when he does he tries making a buzz about it. In his free time he is working on his Python skills and busy improving the @hug.bot code. His family and coworkers are sometimes cause for interesting postings and whenever inspiration strikes he's good for an entertaining rant about random stuff that just comes to his mind. |
---|
Very nice. I'd like to try and program some kind of bot, but I just don't have anything useful I need to see or know. Maybe one day I will think of something again.
If you ever have an idea or need something similar, let me know. Maybe I can help then 🙂
!HUG
I definitely will, thank you!
That's amazing progress over 3 years, well done!
Thanks.
But I've only been doing this for one and a half year now with a lot (and lot and lot) of time in between on hiatus from hive :-)
Hence much appreciated the compliment 😁
!HUG
Fantastic work on both bots. Sending much appreciation from the Sloth community too! Sloth and steady wins the race. It's awesome to see how you've progressed from starting the bot until now. I'm excited to see where you take the bots next, and I always look forward to your messages with new ideas!
!SLOTH
Thank you very much.
!HUG
This is fantastic news! Happy to hear of all the improvements to the !SLOTH (and HUG) bot!
Thanks. It's a lot of fun. :-)
!Hug
Sounds like good improvements :)
Keep up your great work on it!
!HUG
Thanks. Will do ;-)
!Hug
Hola! Me gustaría que el bot pudiera dar una mención recordando cuántos votos libres disponibles hay antes de que termine el día, para que no queden sin ser emitido. A veces me olvido y se "desperdician".
!INDEED
I've put it through translate and got this:
To put that on the chain for everyone would be a lot of spam. If I implement that it would be more a discord feature. But I have yet to think about the up and downside. I will start the discord command bot in the coming days and consider your idea.
!HUG
😆😆 Maybe I should try to come to hive earlier, have a nice weekend 😊
!HUG
!PIZZA
(1/10)
@hannes-stoffel! @ladyaryastark Totally agrees with your content! so I just sent 1 IDD to your account on behalf of @ladyaryastark.
$PIZZA slices delivered:
@ladyaryastark(1/10) tipped @hannes-stoffel
Congratulations @hannes-stoffel! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)
Your next target is to reach 7000 upvotes.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP