How I made a digital friend for myself

in #piston8 years ago (edited)

I always wondered, what it would be like to have a friend with super powers; a magic friend.
On Steemit I now have a little friend, that doesn't sleep, drink or eat - he is just there to help me 24/7.
He lives on his own little laptop computer.

Meet @normaluser :
He now does something

So far I can give him a job and he will just do that until I tell him to stop.
In most cases I just press the on/off button again, if he stops doing, what he should.

I told him to vote everything I say here on Steemit and so far he does that sometimes.
He just doesn't understand me very well and I don't understand him.
We will work it out

This post is meant to inspire you, to invent your own little friend.
I can't walk you through the whole process, because I don't know where you are coming from.
If you have no idea about programming and some time and a computer on your hands, you can follow this blog.
I will try to explain what I have done.

You could do this, too

At this point it's a shoutout to the community.
Maybe we can make a little bot dojo for Steemit, a Steem agent university.

I have no real experience in programming or Linux or any of what I'm doing here.
I had some people help me on chat and I hope they are reading this and I have to

thank you all

a lot.

I'm going to jump straight into coding now, but I'm happy to help anybody at trying this at any step.
To get the steem-piston running, took me a lot.
I honestly don't know where to begin.
It was terrible ... I will blog about it ...

But: if I can do it, you can do it, too.

I know my code will look like a joke to most people, but it somehow does the job and I can read it well.
I don't mind if it's not elegant.
What the bot does so far is:

  • vote for every comment in the stream, that has @felixxx (myself) as an author

I know that's a bit lame, but it's all I can teach him so far ...
The code looks like this:
It's bits from @xeroc s 'tutorials' broken down for @normaluser

python3 votey.py

from piston.steem import Steem # import steem
steem = Steem('posting key here') # unsafe ? I guess ... ( I have no clue tbh )
import os # for beauty
os.system('clear') # clear screen
Print ('Welcome to me script for normaluser') # Hi !
for c in steem.stream_comments(): # for every comment in the stream

if "felixxx" in c['author']: # that has felixxx (me) as an author

print(c.upvote(voter='normaluser')) # vote and return what exactly you voted for

This crashes after a while, but I am exhausted and happy to have just something to show as a result.

What I really want to do is this:

python3 mevotey.py

from piston.steem import Steem
import os
steem = Steem(wif='the posting key goes here') # uhm ....
me = ('normaluser')
os.system('clear') # clear screen
print ('Welcome to me script for ', me )
for c in steem.stream_comments(): # for every such item in stream

if '@%s' % me in c['body']: # that has me name in it

print ('voted : ', c['author'], c.upvote(voter=me))

but it doesn't do anything.

I want to write an introduction for @normaluser soon.
I have big dreams for him and I need your help.
If you like the idea, you can follow him - I will teach him to follow back very soon.

He can be your friend, too :)

Sort:  

Your bot is broken, lets fix it up.

from piston.steem import Steem
steem = Steem(wif='posting key here')

for c in steem.stream_comments()
    if c.author == "normaluser":
        c.upvote()

If you want, you can check out a bot I made a month ago, and released it here on Steemit.

I'd do === just to be safe.

Python isn't a completely broken language, unlike JS. No need.

Thanks !
That would make him vote himself, no ?
He doesn't talk, yet ( maybe he shouldn't )

I want him to vote, whenever his name is mentioned in the body of a post.

in that case, change to:

if "@mentioned-author" in c.body:

great work felix ! really like your work man

I will follow you on this topic. Very interesting.
Thanks for sharing :-)

Awesome art again Felix, spot on. :-)

As much as I am generally anti-bot...I love the way you've been sharing @normaluser 's gestation and birth.

I think I have grown like @normaluser ( love the picture) I look forward to reading more about his adventures in Steemitland as he(?) grows and develops .

Nice approach, keep it up!

I really like this little friend of you. He seems to be nice. Will follow this little guy:-)

Ohhh mann, wie gern hätt ich Zeit auch bissi rumzubasteln. Coole Arbeit! Bleib dran.

Wenn Du Zeit hast hier zu posten ...

hihi, der war gut! Für sowas brauch ich Konzentration. Hier bissi rumzuposten, selbst wenn es halbwegs vernünftiger Content ist, fällt für mich unter Zeitvertreib und Entspannung. Bot-Basteln ist zu nah an meiner Arbeit dran.

Dann kannste mich ja in Deiner Freizeit hier weiter mit votes belohnen, dann bastel ich für uns beide weiter.
Wie gesagt ... ich habe große Pläne für @normaluser.
Und er wird sich alles für immer merken.
Und mich wahrscheinlich überleben.
Aber das versteht scheinbar noch keiner.
Danke jedenfalls für Deine upvotes und Kommentare.
Die bringen was.

you can change formatting, to use code blocks instead quotes:

import os
from piston.steem import Steem

steem = Steem(wif='the posting key goes here')
me = ('normaluser')
os.system('clear')
print ('Welcome to me script for ', me )
for c in steem.stream_comments():
    if '@%s' % me in c['body']:
        print ('voted : ', c['author'], c.upvote(voter=me))

You can do this but using indentation. 4 spaces before each line.

It is three times right-alt 7 on my keyboard. Windows, of course :)

this is formatted

Keep on boting @normaluser

BTW. I think you should keep the record from where onwards are you searching. You don't want to start from block 0 every time...

the piston engine offers this 'stream' feature.
the bot is just listening to the stream, I'm not going through all blocks.
@normaluser doesn't react to a call yet - I'm too lazy.
Also I have to figure out how to ignore the exceptions.

Aha, thanks. I've seen a bookmark in some other code, I think.

I don't know when I'll find some time to set up a steemd system and try it out for myself. The second season for my afternoon job is beginning to warm up which means less and less time for Steemit in the following two months...

In the meantime I'll be cheering for @normaluser :)

Coin Marketplace

STEEM 0.19
TRX 0.13
JST 0.030
BTC 63824.30
ETH 3420.53
USDT 1.00
SBD 2.54