Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 44 lines (32 sloc) 1.06 KB
#!/usr/bin/env python3.5
import random, sys, os
from botclient import Bot
class ReviewOfBots(Bot):
def __init__(self):
super().__init__()
self.ap.add_argument('-n', '--number', type=int, default=None, help="Run n times without posting")
def loadfile(self, filename):
with open(os.path.join(self.cf['dir'], filename), 'r') as f:
lines = f.readlines()
return [ l.strip() for l in lines ]
def load(self):
self.lists = []
for fn in self.cf['wordlists']:
self.lists.append(self.loadfile(fn))
def render(self):
w = random.choice(random.choice(self.lists))
t = w.title()
t = t.replace("'S", "’s")
return self.cf['tweet_template'].format(t)
if __name__ == '__main__':
rob = ReviewOfBots()
rob.configure()
rob.load()
if rob.args.number:
for i in range(rob.args.number):
print(rob.render())
else:
tweet = rob.render()
rob.wait()
rob.post(tweet)
print(tweet)
You can’t perform that action at this time.