Repository
https://github.com/holgern/steem-scot
New features
More than one scot account/token can specified and more options are available
The config for scot_by_comment has now the following structure:
{
"config": [{
"scot_account": "scotaccount",
"scot_token": "SCOT",
"token_memo":"Here is your token thanks to %s",
"reply": true,
"sucess_reply_body": "Dear %s, The token are on its way!",
"fail_reply_body": "You need to stake 10 token, in order to use this service.",
"no_token_left_body": "Please retry later...",
"comment_command": "!SCOT",
"user_can_specify_amount": true,
"maximum_amount": 10,
"min_staked_token": 50,
"usage_upvote_percentage": 0
},
{
"scot_account": "token_issuer",
"scot_token": "TOKEN",
"token_memo":"You got a token",
"reply": true,
"sucess_reply_body": "Here is your token",
"fail_reply_body": "Sorry, you need more token in order to use this service.",
"no_token_left_body": "Sorry, out of token, please retry later...",
"comment_command": "!TOKEN",
"user_can_specify_amount": false,
"maximum_amount": 1,
"min_staked_token": 10,
"usage_upvote_percentage": 0
}],
"no_broadcast": false,
"print_log_at_block": 300,
"wallet_password": "walletpass"
}
Each comment is parsed and all specified commands are checked in a fore loop:
token = None
for key in self.token_config:
if op["body"].find(self.token_config[key]["comment_command"]) >= 0:
token = key
if token is None:
continue
When a fitting config was found, a reply comment is broadcasted and the token are sent, when the user has sufficient (min_staked_token) tokens.
There are more options available that can modify the behavior of the bot.
| Option | Value |
|---|---|
| scot_account | steem account name, which should distribute the token |
| scot_token | token symbol, which should be distributed |
| token_memo | memo which is attached to each token transfer |
| reply | when true, a reply comment is broadcasted |
| wallet_password | Contains the beempy wallet password |
| no_broadcast | When true, no transfer is made |
| min_staked_token | Minimum amount of token a comment writer must have |
| maximum_amount | Maximum Amount of token that will be send |
| user_can_specify_amount | When true, the user can specify the amount to send up to maximum_amount, when false maximum_amount is always sent |
| sucess_reply_body | Reply body, when token are send |
| fail_reply_body | Reply body, when no token are sent (not min_staked_token available) |
| no_token_left_body | Reply body, when no token are left to send |
| comment_command | Command which must be included in a comment, to activate the bot |
| usage_upvote_percentage | When set to a percentage higher than 0, the comment with the command will be upvoted by the scot_account |
maximum_amount and user_can_specify_amount
It is now possible to allow user who staked sufficient tokens specify the amount of token the parent author should receive.
Here, maximum_amount is set to 100 and user_can_specify_amount was set to true.
The amount is parsed be the following code:
# parse amount when user_can_specify_amount is true
amount = self.token_config[token]["maximum_amount"]
if self.token_config[token]["user_can_specify_amount"]:
start_index = c_comment["body"].find(self.token_config[token]["comment_command"])
stop_index = c_comment["body"][start_index:].find("\n")
if stop_index >= 0:
command = c_comment["body"][start_index + 1:start_index + stop_index]
else:
command = c_comment["body"][start_index + 1:]
command_args = command.replace(' ', ' ').split(" ")[1:]
if len(command_args) > 0:
try:
amount = float(command_args[0])
except:
logger.info("Could not parse amount")
There is a new message when the token supply from the token sending account is empty
# Load scot token balance
scot_wallet = Wallet(self.token_config[token]["scot_account"], steem_instance=self.stm)
scot_token = scot_wallet.get_token(self.token_config[token]["scot_token"])
.....
elif float(scot_token["balance"]) < amount:
reply_body = self.token_config[token]["no_token_left_body"]
When not sufficient tokens are left, a reply with no_token_left_body is broadcasted.
The config file, the scot_account and the scot_token is checked
The config file is now checked for missing parameters. It is also checked if the scot_account exists and if the token is valid:
config_cnt = 0
necessary_fields = ["scot_account", "scot_token", "min_staked_token", "comment_command",
"token_memo", "reply", "sucess_reply_body", "fail_reply_body", "no_token_left_body",
"user_can_specify_amount", "maximum_amount", "usage_upvote_percentage"]
for conf in self.config["config"]:
config_cnt += 1
# check if all fields are set
all_fields_ok = True
for field in necessary_fields:
if field not in conf:
logger.warn("Error in %d. config: %s missing" % (config_cnt, field))
all_fields_ok = False
if not all_fields_ok:
continue
# Check if scot_account exists (exception will be raised when not)
Account(conf["scot_account"])
# Check if scot_token exists
if token_list.get_token(conf["scot_token"]) is None:
logger.warn("Token %s does not exists" % conf["scot_token"])
continue
self.token_config[conf["scot_token"]] = conf
Improved logging
It can now be specified how often a logging message is printed by the print_log_at_block parameter. Every print_log_at_block block the following message will now be printed:
The block number of the last log message is stored in a dict:
self.log_data = {"start_time": 0, "last_block_num": None, "new_commands": 0, "stop_block_num": 0,
"stop_block_num": 0, "time_for_blocks": 0}
This allows it to print exactly after the same amount of blocks a new log message.
Commits
adapt readme to chagnes
add better logging, it is possible to define the block diff at which a new logging messaage should be send
check configs and check if token and token_sender account exists
- commit 8b9d07c
- add option to upvote token command user
It is possible to user more than one account and more than one token in scot_by_comment
- commit e65564b
- datadir can be specified
- token amount to sent can be specified
- new message when no token are left
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Chat with us on Discord.
[utopian-moderator]
Thank you for your review, @helo! Keep up the good work!
Damn cool tool.
You get a !BEER from me to relax with this as you did a great job!
Thanks for demonstrating how it works :)
Totally awesome work @holger80, thank you so much for helping distribute ENGAGE and future tokens!
!ENGAGE 100
Hi @abh12345 ENGANGE sounds interesting, here is a !BEER for all your work and ideas.
Have a nice weekend.
Thank you @detlev!
Yes I'm hoping that people have a bit of fun and use the token to !ENGAGE 50 :D
Here are your
ENGAGEtokens!To view or trade
ENGAGEgo to steem-engine.com.To view or trade
BEERgo to steem-engine.com.Here is your
BEERtoken!This tool would be a great addition to STEEM.
To view or trade
BEERgo to steem-engine.com.Here is your
BEERtoken!!beer
It needs to be captitel letter, let me try:):
!BEER
To view or trade
BEERgo to steem-engine.com.Here is your
BEERtoken!You received an automatic upvote, because I believe in you and I love what you create! 😉
A huge hug from @amico! 🤗
😍 I love promoting @steembasicincome, even with #sbi-skip! 😜
Here are your
ENGAGEtokens!To view or trade
ENGAGEgo to steem-engine.com.Thank you so much for participating in the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.00% upvote! Together, let’s change the world!
I don’t understand everything here, but it’s fascinating what I do understand - thanks for the education and appreciate your work. Have a fabulous Friday ! I upvoted and resteemed because I really think your work is important to the great community ... thanks again ! ❤️❤️❤️☕️
Posted using Partiko iOS
Hundred percent excellent, we love this, I must confess that you did wonderfully well.
Let’s spend the token!
Posted using Partiko iOS
@holger80 What an awesome tool, thank you! Am I able to use this with BATTLE Token?
I can add your token to my bot. Do you have a discord link?
You need basically fillout the following json:
"scot_account": "battlegames", "scot_token": "BATTLE", "token_memo":"Here is your token thanks to %s", "reply": true, "sucess_reply_body": "Dear %s, The token are on its way!", "fail_reply_body": "You need to stake 1000 token, in order to use this service.", "no_token_left_body": "Please retry later...", "comment_command": "!BATTLE", "user_can_specify_amount": true, "maximum_amount": 100, "min_staked_token": 1000, "usage_upvote_percentage": 0I need active permission, so that my script can send out BATTLE token, or you can the script on your own server.
!ENGAGE 20
!ENGAGE 1
I need to test the bot, sorry :)
!ENGAGE 5
!ENGAGE 2
Here are your
ENGAGEtokens!To view or trade
ENGAGEgo to steem-engine.com.Here are your
ENGAGEtokens!To view or trade
ENGAGEgo to steem-engine.com.!ENGAGE 50
Testing
!ENGAGE 20
Here are your
ENGAGEtokens!To view or trade
ENGAGEgo to steem-engine.com.Lets test this out!
!BATTLE 100
Here are your
BATTLEtokens!To view or trade
BATTLEgo to steem-engine.com.!ENGAGE 1
Testing!
!ENGAGE 1
also testing...
Here are your
ENGAGEtokens!To view or trade
ENGAGEgo to steem-engine.com.Hi @holger80!
Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 7.375 which ranks you at #60 across all Steem accounts.
Your rank has not changed in the last three days.
In our last Algorithmic Curation Round, consisting of 202 contributions, your post is ranked at #1. Congratulations!
Evaluation of your UA score:
Feel free to join our @steem-ua Discord server
Congratulations @holger80! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOPTo support your work, I also upvoted your post!
Do not miss the last post from @steemitboard:
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Hey, @holger80!
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!
Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!
Hi, @holger80!
You just got a 2.99% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.
hi @holger80, sent you a note on discord .. not sure if you have seen it yet.