[Steem Assistant A0.21] Development Update 19/03/2018

in #utopian-io7 years ago (edited)

SteemAssistant-27.png

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

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @amosbastian, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Hey @jestemkioskiem I am @utopian-io. I have just upvoted you!

Achievements

  • WOW WOW WOW People loved what you did here. GREAT JOB!
  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

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

I am working on python and django from a while. May be I could help a little for your project.

If You are interested in SteemConnect authentication, take a look at my implementation for SteemNova project.
It is PHP code, but the scheme is the same for every other programming language.

Honestly, the biggest challenge so far is just to get the web app and authentication running. I've never done webdev, I don't love webdev, you know - the usual.

I'm likely going to use Django or Flask, and @noisy has made an awesome library for steemconnect & python a long time ago which I'm likely going to utilize. That being said, I really don't want to mess this up, so I'll gladly check out your code. Thanks a lot!

There might be a problem because, as far as I am considered, this library uses implicit grant type of OAuth2 and you won't be able to use an offline scope, which is gonna be quite annoying for the end user.

Without the offline scope, you can't gain access to refresh_token which is used to refresh access to the SteemConnect service on the behalf of the user. Why?

access_token expires after 7 days, so without refresh_token your end user would have to repeat sign in flow every 7 days.

A system like SteemAssistant to be user-friendly IMO has to implement authorization grant OAuth2.

I did not know that, thank you a lot for sharing.

Even though I hope I can get to this point and get authorization grant going for this project, the steemconnect functionality will be surprisingly easy on the end user, it will even allow them to disconnect after pairing and change their private keys. All that thanks to how amazon echo pairing works.

That being said, the idea is to also implement customization onto the web app, which will be annoying to use if you get logged out of SC constantly. I'll research the topic and see if I can come up with a solution to this, if not, maybe it's time to go php and use existing resources.

Hi, I am this one dude from facebook group who you told about Steem. I greatly apreciate that. I will be following your work. Have a good one.

Hey, I think you got me confused with someone! I was introduced to steem by my real life friend.