The Release
Here it is:
The Features
The bot performs the following actions:
- React to (can be many different) !commands
- Check requirements (in stake or liquid) of the tip token in the caller's wallet
- If requirements are met, send or stake tokens to caller and/or recipient of the original comment
- Reply either with a comment or within a daily collection post
- Jinja2 templates for collection post, comments and transfer memo
- Upvote original post depending available mana and recipients token amount
For the developer/operator it brings:
- Logging via Discord webhook
- Configuration via SQLite3 database -> can be changed live by other programs and the bot picks up the new config immediately
- Logging of recognized commands and the result (success or reason for failure) to SQLite3 database
- Tied up neatly into a class to be integrated into other scripts
- Open Source MIT License so go nuts and have fun if you think you can make use of it in other projects
The Story
And for those interested, here is the story of how it got there:
Slothbuzz Community. I did work as a coder in the late 90s and early 2000s albeit my experience would not bring me very far today. I wrote mostly Pascal (later on Delphi) code in those days.Many moons ago @slothlydoesit mentioned to me, that he was looking for a coder to write some scripts for
I did not know how the Hive Blockchain actually works. To be honest, even today I think I just scratched the surface of understanding it, but I learn something new about Hive almost every day.
code for Hive Pizza Bot. That was my starting point.So why not combine that with learning a new language? I had heard a lot about Python and @slothlydoesit did some leg work to lure me in. He found the
Since I already had experience in coding I knew about if clauses and while loops. I knew about Classes and Objects and all that stuff. The big obstacle was to learn what's so special about Python and how Hive actually works.
For Python there are many Tutorials available as text and video so I was able to catch up fast enough to get the script up and running. Then I started to learn about Hive. I was able to watch the live feed of the blocks, inspect every block, and so on. Over time it dawned on me how things are handled in the background.
I got the script to a most basic version of what we (me for hug.bot and @slothlydoesit for sloth.buzz) wanted: Get triggered by a command in a comment, transfer a token and reply with a comment.
That was not really worth publishing and I said when there are some more features to it and it's a nice, clean and stable code, I will publish it to give back to the community. After all, if it were not for someone else making their code open source, I think I never would have had a chance to get this code to where it is today.
Over time, while adding those new features and hunting down bugs, I started to extend my Python knowledge. Every day I discovered something new. With every feature or bug hunt I find some new way to implement it or correct what was wrong.
I promised to release the code the moment it is satisfactory to me. Well, that point was never reached. Self doubt always was and is present. How can I be sure this is it when I find better ways to write this code every day I work on it? I finally reached the conclusion: I never will be sure, it never will be perfect. Perfect is the enemy of good
So I'm not aiming for that anymore. It is running stable, it is doing what I want it to do. That is good. And that is all. There will always be a better way to do things. But there will also be worse ways.
I took the last two weeks to clean up the code one final time. Rewrote one or two "crutch" parts, wrote a lot of comments, put in some documentation and finally started to learn another skill: Github.
And here we are. If you read this far, I thank you very much for your interest in my story and I wish you a nice weekend and enjoy spreading !hug 🤗
Cheers and !Hug
Hannes
![]() | @hannes-stoffel is a geek with a dayjob. He writes about his passions (including his family of course), geek stuff and every day anecdotes. In his spare time he improves his Python skills while working on the code of @hug.bot and @sloth.buzz community bot. |
---|
@hannes-stoffel, I'm refunding 0.124 HIVE and 0.029 HBD, because there are no comments to reward.
Typical sloth late to the party, not sure how this post slipped me by, love the code, thanks for all the effort you've put in thus far! Sloth buzz wouldnt be much without your buzz driving us forward.