CLOSED: 125 STEEM Developer Bounty Inside [Python]

in #steemdev6 years ago (edited)

NOTE: THIS BOUNTY IS TAKEN SINCE BLOCK 19640323

The other day, I found this bot:

https://github.com/E-D-A/steem-curatebot

by @danielsaori

Yesterday, I forked the code and converted it to do @deutschbot's job:

https://github.com/fxnormaluser/steem-deutschbot

This is what it does:

Steem deutschbot is a fork of:

https://github.com/E-D-A/steem-curatebot

Steemit curation bot with Discord integration.

The bot will login to Discord and starts to listen to the blockchain in the background.

It holds a list of 'trusted curators' for a certain hashtag on Steem. (#deutsch)

It streams all votes of the 'trusted curators' and their vote_weight and calculates a score for each post.

If a certain threshold is reached, the bot will vote for a post and broadcast its vote to Discord.

Commands:

$blacklist STEEMUSER
$curator STEEMUSER
$set_threshold 10000 (= 100% vote_weigh)
( leave argument blank to return a list )

The script works and does that job;
It's not nice code, at all:

  • it crashes unexpectedly ( 25 Steem )
  • it makes too many API calls ( @gtg will not like it ) ( 25 Steem )
    Perhaps, parsing the stream to a local db would be a solution ...
  • ... the db system is awful ( 25 Steem )
  • I have to initialize the Steem() Object at different points in the code for it to work and I don't exactly understand why. ( 25 Steem )
  • Optional:
    I have to use set_shared_steemd_instance to manually override which nodes Steem-Python connects to.
    This would need to be fixed in the official repository. ( 25 Steem )

If you can fix or upgrade my code, feel free to do so.

If you can fix one or more of the issues mentioned above, I will reward you in Steem;

125 Steem in total*

This bounty ends, when the payout-period of this post ends.

  • Make a pull request on github
  • Comment and link your PR under this post

Of course, your code has to work.

In case of multiple entries, I will try to pick the smartest solution.
However, if your solution works, you will probably win a price, anyways.

It took me a whole day to come up with the new deutschbot.py.
I figured, it would take a skilled programmer another day to clean up my mess.

Therefore, I hope 75 - 125 STEEM is enough.


*Disclaimer:

I will simultaneously work on the code, too.
If I find the best solution myself, I reserve the right to keep some of the bounty.
Furthermore, if no valid entries are made, I will keep the bounty for a later try.


Feel free to contact me here or in Discord, if you have any questions.

Sort:  

hi @felixxx,

The script looks like too messy to refactor. I can do a complete rewrite in 24 hours for a total 125 STEEM. What do you think about that? I am experienced w/ discord and steem api's.

Don't know enough Python but totally agree sometimes to clean up the mess takes a longer time than to redesign and rewrite the thing :-)

I agree, that it really is messy.

If you did a complete redesign, I'd like to plan ahead for some extra features.

I'll just wait for some more replies, to give others a chance - Hope that's ok.

No problem.

I have a couple of ideas:

  • Don't parse every block. Instead use get_account_history for each curator and filter only votes. Much more cleaner code and less overhead. This will remove almost half of the code.

  • Use mongodb to log already sent votes and check from there.

  • Use supervisord to restart the bot if bot goes down. Fixing the main reason is the real solution however you can always use Supervisord to auto-restart the process.

  • Custom node settings are not valid on some internal classes of steem-python. There are a couple of pull requests waiting for approval about this issue but they didn't do that yet. Using get_account_history with a custom list of nodes working well though. So, this won't be a o problem.

Let me know, if you decide for a rewrite.

my Discord id: emre#9263.

Another feature of the bot ( which now runs as a separate script ) is to drop a comment under posts, when the author has used #deutsch for the first time.

To integrate that I'd need to get all blocks.

Yes, you will need to listen then. However, I strongly suggest keeping them separate processes. Totally different things. For the sake of "seperation of concerns". They may exist in the same repository but I don't recommend same process.

For the welcome functionality:

$deutchebot --welcome

It will listen all blocks and welcome users if they use the tag first time.

For the discord/curate functionality:

$deutchebot --curate

It will not listen all blocks, will work with get_account_history.

I understand, but ...

... I wanted both functions to broadcast to discord with the same bot ID :/

ah, if the "welcome bot" does something with the discord, it's okay. :)

Hmm This sounds a pretty interesting, but the code seems to be missing something. I'm not sure what, just a feeling.

Cant help but like this idea! :) go for it !

a very good post
anyone who reads it will like it
I really like your posts
@muhammadkariman

danke schön!

you are one of those people who are always grateful and patient. you deserve success in all areas.

Beautiful cute post so sweet