Making a Steem Bot

in #steem7 years ago

for those who want to learn how code bots.

So first you must have the follow pre-reqs:

  1. Python knowledge
  2. Some programming experience.

So how to you create a posting bot with these simple lines of code:


from steem import Steem
from steem.post import Post

steemAccount = Steem(keys=['insert keys'])
posted = steemAccount.commit.post("title of the post", "the body, were your writing goes", "nameofaccount", tags=postDict['tags'], self_vote=True)


So with the above simple set of lines u can post a new post, pretty cool hey. So lets break down the code a little:



from steem import Steem
from steem.post import Post


The first 2 lines import the modules u need to login in as a Steem account and then Post using the Post module.

**
steemAccount = Steem(keys=['insert keys'])
**

This line lets u put in your steam keys, typically you just wan to use your posting key so that if a hacker gets into your code u only has to worry about him posting and nothing else. If you need the program to do money transactions and or voting then you entering in more keys like suck:


steemAccount = Steem(keys=['posting key', 'voting key','transfer money key'])


Pretty simple and straight forward.

Ok the next step is posting, which is covered by this line:


posted = steemAccount.commit.post("title of the post", "the body, were your writing goes", "nameofaccount", tags=postDict['tags'], self_vote=True)


so you have to access your steemAccount then access the commit method and post method. Then u need to pass in the title, body and name of the account you are posting with and finally pass in tags as an array. This is where you thing your post should go and be search via index.

So I hope you enjoyed this short tutorial.

#please vote for me as a witness if you like my technical expertise and I really want to make a difference when it comes to the steam community.

https://steemit.com/~witnesses

Sort:  

love bots

literally thinking about this today. thanks for sharing

@danlupi..hello..your post is good..the article making me so inspire..many knowledge i have after reading your post..i very like after being as stemian friends..sorry my english maybe make u not understanding..but sure..i learn english..i know what u say and writing in this post..some time if you have the time..vote my post and come to my blog..nice to reply your post..this coment i write by my self start to study hiw to talk english well..

This could come in handy. Thanks for the tutorial. :)

Hi @jrcornel,

Congratulations! You have been chosen to appear on another amazing edition of "Who to Follow Daily". Thank you for adding so much value to the Steemit community. Steem on!

Awesome post! Thanks for sharing your knowledge with us~!

This post received a 4.0% upvote from @randowhale thanks to @danlupi! For more information, click here!

Thanks a lot for the guide! I'm starting to get into CS and this would be a fun (and maybe even profitable) project.