The Complete Source Code for a Simple Steemit Dickbutt Reply Bot Written in Python Using Steem-PistonsteemCreated with Sketch.

in #funny8 years ago

Recently someone was asking me for a copy of the script I use for the @dickbutt bot. Rather than just giving a copy to one user I've decided to give all Steem users a gift for xmas this year, I give you all an out of the box dickbutt bot (try saying that 3 times fast).

The bot is a rather crude script I made as an exercise in learning python and piston. You will need to have Python 3 and Steem-Piston installed to use it. The script can be used as a template if you want to create something that watches the stream of new posts & comments looking for a few criteria and then posting a random response from a list.

The main script is dickbutt.py. You will need to insert your own private posting key and account and username where it says PUTYOURKEYHERE and YOURUSERNAMEHERE. The script looks for a file in the same directory named dickbutts.txt. It will choose a random line from that file to be the comment that it posts as a reply.

dickbutt.py

from piston.steem import Steem
import os
import json
import traceback
import sys
import csv
import random

dickbutts = []
categories = ['test', 'funny', 'joke', 'adult', 'humor', 'humour', 'lol', 'nsfw']
with open('dickbutts.txt', mode='r') as infile:
    reader = csv.reader(infile)
    for rows in reader:
      dickbutts.append(rows[0])

steem = Steem(wif="PUTYOURKEYHERE",node="wss://node.steem.ws")
for c in steem.stream_comments():
  if bool(set(c["_tags"]) & set(categories)):
    if "dickbutt" in c["body"].lower() and not "dickbutt" in c["author"]:
      try:
        response = c.reply(random.choice(dickbutts), title='', author='YOURUSERNAMEHERE')
        print(response)
      except:
        traceback.print_exc()

dickbutts.txt

https://s17.postimg.io/rwalddxbz/flat_800x800_070_f_u2.jpg
https://s17.postimg.io/f66d0apdr/Dick_Buttpink.jpg
https://s17.postimg.io/kiv7efda7/dickbutt_mark_by_reilpikram_d8busm9.png
https://s17.postimg.io/gb50jf18f/l_VRUEc_A.png
https://s17.postimg.io/j6i3qa58f/dickbutt.jpg
https://s17.postimg.io/uk4n1hfr3/Hto_Ek_Gy.gif
https://s17.postimg.io/4eddyxzb3/dbspin.gif
https://s17.postimg.io/ozs5qugvz/WUGj_Yy_A.gif
https://s17.postimg.io/eqzol0su7/raw.gif
https://s17.postimg.io/oct91bjzz/dogedickbutt.gif
https://s17.postimg.io/uf0vrt8fz/dbupvote.gif
https://s17.postimg.io/u3jff1rzz/105441_dickbutt_rainbow_wiggle_gif_Im_6_YAW.gif
https://s17.postimg.io/otj21hx4v/DFDL8_E2.gif
https://s17.postimg.io/aod8zoo3j/dbgiphy.gif
https://s17.postimg.io/ojbji5iin/m5_En_TSs.jpg
https://s17.postimg.io/uyaketp8f/753_png.jpg
https://s17.postimg.io/8nmpeury7/flat_800x800_070_f_u1.jpg
https://media.giphy.com/media/lXiRoPY1WNZX1qxws/giphy.gif
http://p.fod4.com/p/media/092b2c9b9e/ClrRYRxqSrKuYsE73SMh_DIck%20Butt%20Simpsons.gif
https://media.giphy.com/media/dcd6WrsjIxpbq/giphy.gif
https://media.giphy.com/media/UOORDCKFofUju/giphy.gif
http://i3.kym-cdn.com/photos/images/list/001/129/877/db4.gif
http://i.imgur.com/FmFjQmw.gif
http://i.imgur.com/q9msmmg.gif
<img src="https://media.tenor.co/images/afa789d69a689427ee3cb0d184ad511f/raw">
http://i.imgur.com/1PQRIwO.gif
https://media.giphy.com/media/R8Dz80qD3D7KE/giphy.gif
https://media.giphy.com/media/EWtegVZUEizIs/giphy.gif
https://media.giphy.com/media/11K25sT17xCss8/giphy.gif
http://p.fod4.com/p/media/092b2c9b9e/yD2VVnymTpK3RLy7RsZX_Dick%20Butt%20Breaking%20Bad.gif
http://0.media.dorkly.cvcdn.com/32/88/4bc9b564dace7f2cea6b7bb4d14afd7e.gif
http://iruntheinternet.com/lulzdump/images/futurama-dick-butt-toast-bread-fry-1408962840n.gif?id=

Make sure to follow this profile @contentjunkie to stay up to date on more great posts like this one.

Sort:  

One thought...

Maybe implement leash codes so the bot doesn't go where it's not wanted. Just have it check the body of the post for "steembotstay" or the post tags for #steembotstay

It's not a big change. But most people are going to copy/paste this code and use it as an autoresponder. When they do they're going to get flagged hard if author didn't want bots in their posts.

The leashcodes system was envisioned as a way to regulate bots. #steembotcome to explicitly invite and #steembotstay to explicitly exclude.

Ohh this is nice, but it isn't going to end well.
Awesome work! I hate dickbutt, but I've gotta give you props on your skills as a developer.

Well in its current form the bot is somewhat neutered. It will only post in limited categories and if a post author says dickbutt.

The hope is people can use it in more useful ways than @dickbutt.

Like I said, mad props to you for this. But I'm afraid you've started bot wars 2.0 :D
Bot Wars 2.0 "Attack of the Memes!"

Dind't Dickbutt make huge probalems for a particular user back in the summer?

Is it that same dickbutt?

Is it gonna come and destroy someones rep over it?

I thought i'd never hear the words Dickbutt again. lol

Interesting post, gets my vote

haha. wow he's fast. lol

CandyMan needed to be said 3 times in the mirror.

Funny, looks different than the one i saw before.

The script is heavily restricted compared to the first version.

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

See the full rankings and details in The Daily Tribune: Dec 14 - 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.

LMFAO! This shit is hilarious! Upvoted for the good laugh, haven't really thought of the repercussions on the steemit community though:p

A great example for learning and adapting. Thanks!

dickbutt

Coin Marketplace

STEEM 0.19
TRX 0.14
JST 0.030
BTC 59876.72
ETH 3191.77
USDT 1.00
SBD 2.43