THE MACHINE THAT GOES "PING!" [v0.0.3]

in #steem7 years ago (edited)

Yes, and here's the python code for it:

import time
from sys import stdout
from steem import Steem
from steem.account import Account

ver = "0.0.3"

usr = "tpos"
wif = "5tH1sI50bVioU5lYaF4K3vv1Fk3yh0w3vEr17rieD2m4kEits0e"
acc = Account(usr)

def f_balance():
   return "%s [CEST]: pot's current balance is %s" % (time.strftime("%Y.%m.%d %H:%M:%S"), acc.balances["STEEM"])

def f_version():
   return "I'm TPOSbot, version %s" % ver

commandlist = {
   "tpos:POT_BALANCE": f_balance,
   "tpos:POT_VERSION": f_version,
}

steem = Steem(keys=[wif])

print("[ \033[33mTHE MACHINE THAT GOES 'PING'.\033[0m v%s ]" % ver)

for post in steem.stream_comments():
   try:
      stdout.write(".")
      stdout.flush()
      for command in commandlist:
         if command in post["body"]:
            stdout.write(". ")
            stdout.flush()
            try:
               post.reply("%s" % commandlist.get(command)()," ","%s" % usr)
               time.sleep(20)
               stdout.write("\033[32mPING\033[0m ")
               stdout.flush()
            except:
               stdout.write("\033[31mF00K\033[0m ")
               stdout.flush()
   except:
      stdout.write(" \033[31m5H17\033[0m ")
      stdout.flush()

actually it's Pot of STEEM bot's code ... Enjoy ;)

Sort:  

This post has been ranked within the top 80 most undervalued posts in the first half of Feb 12. We estimate that this post is undervalued by $4.06 as compared to a scenario in which every voter had an equal say.

See the full rankings and details in The Daily Tribune: Feb 12 - Part I. You can also read about some of our methodology, data analysis and technical details in our initial post.

If you are the author and would prefer not to receive these comments, simply reply "Stop" to this comment.

Well, that's just grand.

tops:POT_VERSION

And, delightfully, my autocorrect has made a fool of me. Let's try again:

tpos:POT_VERSION

I'm TPOSbot, version 0.0.2

[v0.0.3] added an try clause, so the bot won't die on "Post does not exist" exceptions

2017.02.12 06:26:29 [CEST]: pot's current balance is 940.974 STEEM

this is how it works:

a person enters a command in their post/reply
ex. tpos:POT_BALANCE

and the bot answers - as you can see below :)

2017.02.12 00:45:09 [CEST]: pot's current balance is 855.974 STEEM

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 65128.68
ETH 3442.23
USDT 1.00
SBD 2.52