[SockoBot] Added $delegate & $help and an option to disable $register and check_for_payments().
SockoBot is trying to be the only tool you'll ever need on your Discord Server or Facebook Page when it comes to steem, while also being easily expandable to anyone that knows a bit of Python.
SockoBot
New Features
What feature(s) did you add?
- The
$delegate
command was added to provide an easy way to delegate SP from one account to another (utilizing SteemConnect for security).
elif text.lower().startswith('delegate'):
try:
user_name = text.split(' ')[1].lower()
value = float(text.split(' ')[2])
target_user_name = text.split(' ')[3].lower()
except IndexError:
await client.send_message(msg.channel, error_message)
return None
await client.send_message(msg.channel, 'To delegate using **SteemConnect**, click the link below: \n %s' % (delegate(value, user_name, target_user_name)))
- The
$help
command as well as the help message and a new error message were added for quality of life purposes.
$help
elif text.lower().startswith('help'):
if client.pm_help == True:
await client.send_message(msg.author, help_message)
else:
await client.send_message(msg.channel, help_message)
messages
help_message = str('Please, refer to <https://github.com/Jestemkioskiem/steem-sockobot/blob/master/README.md> for more desriptive help. \n\n \
**Commands and their arguments:**\n\n\
%(p)s*ping*\n\
%(p)s*convert* <value> <coin1> <coin2>\n\
%(p)s*delegate* <delegator> <value> <delegatee>\n\
%(p)s*payout* <username> <days>\n\
%(p)s*price* <coin>\n\
%(p)s*register* <username>\n\
%(p)s*sp* <username>\n\
%(p)s*vote* <username>\n\
%(p)s*wallet* <username>\n\n\
To get help regarding non-command functionality, refer to the github page\'s README.md file and it\'s Wiki, or contact the developer at Jestemkioskiem#5566') % {'p' : client.command_prefix}
error_message = str("The command you tried doesn't exist or you didn't provide enough arguments to run it. Use %shelp to see a list of commands and their arguments.") %(client.command_prefix)
- An option to disable $register and check_for_payments() was added, leaving them disabled by default.
REGISTRATION = False # True to enable the use of the REGISTER command.
if REGISTRATION:
ROLE_NAME = '' # Put Discord server's granted role name, used with the REGISTER command.
SERVER_ID = '' # Put Discord server's ID
minimum_payment = 1.000 # Price of registration, in STEEM
The
NAME
,TOKEN
andKEY
variables got their names changed toSB_NAME
,SB_TOKEN
andSB_KEY
respectively to avoid issues with building the bot alongside other system applications.To use
$delegate
, adelegate()
function was created.
def delegate(sp, user_name, target_user_name):
link = 'https://v2.steemconnect.com/sign/delegateVestingShares?delegator=%s&delegatee=%s&vesting_shares=%s' % (user_name, target_user_name, round(sp, 3))
return link + '%20SP'
Some of the code was rewritten to be more clear and a few new comments were provided.
On top of that, all of the above functionality (except register which is different on messenger) has been properly altered and added to the capabilities of the Messenger iteration.
Bugfixes
- Fixed an issue where
$payout
without an argument would not return an error message. - Fixed an issue where the bot would not use the newest data from coinmarketcap when using a command that had to pull a price of a coin, instead using old, cached data.
How did you implement it/them?
Nearly all of the code can be found in the examples above with proper explanation, but you can look it up in the commits as well: 8ff240f, 97756d9.
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Hey @jestemkioskiem I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x