Steem Assistant (Version A0.21)
commit 2543324, commit 2002015
Welcome to the development update regarding the A0.21 version of the smart voice interface for the steem blockchain - Steem Assistant. In today's upvote, further updates to the already existing base with new intents & scalable functions were made. Behind the scenes, a steemconnect webapp is already being developed, which will allow further improvements.
For now, the Live version uses @ned's account for testing & display purposes, although sometimes next month, a web application utilizing SteemConnect will be launched, allowing you to easily connect your steem assistant to your steem account.
As always, you can find all of the code over at the github repository, under the MIT License. All feedback and help is more than welcome!
Use it now for absolutely free!
If you want to use the Alpha version for free, just create an Alexa Skill over at developer.amazon.com and set the endpoint to https://steem-assistant.herokuapp.com/steem_assistant ! I'll pay for the server!
New Features
Added 2 new intents.
PotentialPayoutIntent
Allows the user to check his potential payout from up to 20 posts & 50 comments. These numbers are easily editable, but most users should never surpass that limit.
@ask.intent("PotentialPayoutIntent")
def check_potential_payout():
user = SteemUser(nickname)
usd, steem, sbd = user.calculate_estimated_payout()
if usd == 0:
return statement("You have no potential payout. Try posting & commenting more.")
return statement("Your potential payout is: %s Steem Dollars and %s Steem Power. That's about %s USD." % (sbd, steem, usd))
ConvertCoinIntent
Allows the user to convert any of the top 500 coinmarketcap coins into an another cop from that list. Just ask "steem, how much steem can I get for 2 bitcoin?" or something of this sort!
@ask.intent("ConvertCoinIntent")
def check_converted_price(coin, second_coin, amount):
if not amount:
amount = 1
amount = float(amount)
data = check_prices(coin, second_coin)
first_price, second_price = data[0]['price'], data[1]['price']
conv_rate = first_price/second_price
value = amount * conv_rate
return statement("You can receive around %s %s for %s %s" %(round(value, 4), data[1]['name'], int(amount), data[0]['name']))
Added scalability to the code with 2 new functions
calculate_author_payout()
Returns the potential payout from a value displayed under the post, with the ability to exclude curation from this calculation. Returns 3 values - USD, SBD and SP in a tuple.
# Calculates author payout in USD, SBD and SP respectively, then returns them.
def calculate_author_payout(value, curation=True):
steem_price, sbd_price = check_prices('steem', 'steem-dollars')
steem_price, sbd_price = steem_price['price'], sbd_price['price']
if curation:
value *= 0.75
sbd_payout = round(value/2, 3)
sp_payout = round(sbd_payout / steem_price, 3)
value = round(sbd_payout * sbd_price + sp_payout * steem_price, 2)
return value, sbd_payout, sp_payout
check_prices()
Takes in any amount of coin names as arguments and returns a list of dictionaries with keys being name
& price
for the coin's name and usd price, respectively.
# Checks prices of Steem & SBD respectively, returns them in a tuple.
def check_prices(*args):
response = requests.get("https://api.coinmarketcap.com/v1/ticker/?limit=500")
data = json.loads(response.text)
coins = []
for coin in args:
for x in data:
if x['id'].lower() == coin.lower() or x['symbol'].lower() == coin.lower():
ph_dict = {}
ph_dict['name'] = x['id']
ph_dict['price'] = float(x['price_usd'])
coins.append(ph_dict)
return coins
Roadmap
The current priority is developing personalized Intents & launching an SteemConnect enabled website, which will utilize OAuth2 to allow you to connect your steem username to your assistant.
In the meantime, new Intents will be developed and older Intents will keep being updated to eliminate bugs & speech recognition issues.
How to contribute?
You can contribute to echo.py as well as skill.json directly by creating a Pull Request to my repository, or you can contact me on Discord at Jestemkioskiem#5566 to talk about this project!
I'm looking for Python developers, Web developers and people experienced with handling sensitive information ready to build a website centered about SteemConnect and OAuth2.
Posted on Utopian.io - Rewarding Open Source Contributors