It's alive!

avatar
(Edited)


image.png
Picture from imgflip.com

divider_hannes_sloth.png

A new bot in town?

Thanks to input by community members in the slothbuzz discord the idea of a tipping bot took shape.

The quickest solution was taking the code from Pizza Bot and send it on its way with a few adjustments. You know, the typical stuff. Giving out SLOTHBUZZ tokens instead of PIZZA and what command to look for.

But, oh my, that code is now over two years old. And sadly the bot crashed over and over again.

Of course we know the actual PIZZA bot to be working perfectly. As do many other bots. But there is no code available to replicate that for the sloth.

All the currently running bots (as far as I could research) are somewhat closed source. I understand and join that sentiment. Why give away something for free if we worked so hard to get it working?

divider_hannes_sloth.png

Getting back into the game

After 10 years of absence I decided to get back into the game. I have never done python programming before but a few other languages.

After a crash course tutorial on python to get the basics down I took a look at the code to figure out what is wrong.

A big thank you to the PIZZA Guild for putting it up there. It helped me a lot to get started and to figure out how things should work.

To get the most out of it for myself, I decided to start from scratch. The PIZZA code was a big help in pointing me into the right direction and what libraries to use.

I opened my own little Discord test server and after just a few lines of code I was able to read this message:


image.png

From there I built a new bot from scratch, step by step.

divider_hannes_sloth.png

What does it do?

It is a pure tipping bot. It reads the comments from the blockchain and looks for one specific command (to be set in the config file).

Then it checks the wallet of the comment author if it meets the requirements for a call.

If the call is accepted the tip is sent and a comment written to inform the author and recipient.

Otherwise a comment is written to inform why the call failed. Except for self tipping and tipping the bot. If you do that, it will simply be ignored.

If a Discord webhook is provided in the config file, all those actions are logged into that discord channel.

divider_hannes_sloth.png

What is different?

First of all I did not integrate any kind of vote following. The goal was a pure tipping bot.

I put in exception handlers to at least get a discord message out if something causes a crash. That way we can notice it much earlier, as long as the exception is not related to network or Discord failure.


image.png

The configuration of tipping levels is completely different.

The old config needed one config section per tipping level and adjusted code to read in that config. Now it is based on a list that can have as many entries as you want:


image.png

In this example we put in 5 tipping levels:

  • 50 Tokens staked: make 50 calls per day with 0.01 tipped
  • 20 Tokens staked: make 40 calls per day with 0.01 tipped
  • 10 Tokens staked: make 30 calls per day with 0.01 tipped
  • 5 Tokens staked: make 20 calls per day with 0.01 tipped
  • 1 Token staked: make 10 calls per day with 0.01 tipped

We can simply adjust these numbers in the config with as many entries as needed.

A few other options have been introduced, including these two:

image.png

This comma separated list (like the staking levels above) will allow community moderators and ambassadors to tip without restriction and the need to stake up a lot of tokens.

And with the permlink added to the log message, the Discord looks like this:


image.png

The internal logic was completely rewritten. I thought about going on a bug hunt and simply try to fix the bot. But then again, I wanted to gain the most experience in a new language. So I decided for a rewrite.

divider_hannes_sloth.png

So what now?

Now I'm waiting for my baby to go live as sloth.buzz bot and hope it won't disappoint me. The bot is live, that was the main goal. If Now with that accomplished I will have some time to work on the next version.

In the meantime I am in a pickle. On one hand I remember the feeling of frustration when we were looking for a bot to put to use. So many are live on the chain and none available to be put to use. How great would it have been had we stumbled upon this code? Problem solved.

On the other hand I had a lot of fun learning python and have to admit I really started to like this language. And of course, honestly, I don't want to simply hand out free stuff. After all, the others aren't doing it either.

In the future

Once Now that the bot is live and running I want to develop the next version. There are many ideas in my head on how to further improve its usefulness to the community. And I am already getting excellent suggestions on what to implement next.

When that is done and the new version is running live, I will put today's version up on github for everyone else to use for free. That should get rid of my pickle situation.

If you are interested in the code before that time, feel free to contact me. I am sure we can work something out.

divider_hannes_sloth.png

Thank you for reading and look out for the !SLOTH



0
0
0.000
22 comments
avatar

Awesome post! Awesome bot! We'll hopefully have it up and running soon!

Thanks for all the time and effort you spent on this! Glad you found your buzz of coding again! The possibilities are endless on Hive!

0
0
0.000
avatar

Thanks for giving me the opportunity. 😊
So nice to see it up and running and doing its thing.
!BBH

0
0
0.000
avatar

Again, awesome work Bro, thanks so much 🙏

DeNiro: You!

!SLOTH

0
0
0.000
avatar

Thank you very much. 😊
Glad it is up and running now.
!PIZZA

0
0
0.000
avatar

It's ALIVE!!!

!ALIVE !PIMP

But more improtantly !SLOTH

0
0
0.000
avatar

Awesome result :)
!SLOTH

Posted using sloth.buzz

0
0
0.000