Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #twitter boot made by Valery
- #from an online tutorial
- #the imports
- import os
- from markovbot import MarkovBot
- # Initialise a MarkovBot instance
- tweetbot = MarkovBot()
- #read the text file
- dirname = os.path.dirname(os.path.abspath('text.txt'))
- # Construct the path to the book
- book = os.path.join(dirname, 'text.txt')
- # Make your bot read the book!
- tweetbot.read(book)
- my_first_text = tweetbot.generate_text(25, seedword=['dream', 'psychoanalysis'])
- print("tweetbot says:")
- print(my_first_text)
- # ALL YOUR SECRET STUFF!
- # Consumer Key (API Key)
- cons_key ='k0ImNXT4VZjrQpcCr2wyg1M1l'
- # Consumer Secret (API Secret)
- cons_secret = 'uPRpOVf01CXVfb8cDvUAZfFX2LKftJioRQq9seyMWI6pkbcqpb'
- # Access Token
- access_token = '619802148-Ru2rdgxK3CS6Kl1UTFDYkrd5Us5QdjghyM0vPjwH'
- # Access Token Secret
- access_token_secret = 'QmRlhtZ0wYd0FhtZzySjhJHfGojXrvi7RJnjIC1E0ZeYe'
- tweetbot.twitter_login(cons_key, cons_secret, access_token, access_token_secret)
- targetstring = 'project'
- keywords = ['arduino', 'circuits', 'flowers', 'children', 'religion','raspberry','pi']
- prefix = None
- suffix = '#DoIt'
- maxconvdepth = None
- # Start auto-responding to tweets
- tweetbot.twitter_autoreply_start(targetstring, keywords=keywords, prefix=prefix, suffix=suffix, maxconvdepth=maxconvdepth)
- # Use the following to stop auto-responding
- # (Don't do this directly after starting it, or your bot will do nothing!)
- #tweetbot.twitter_autoreply_stop()
- # Start periodically tweeting
- tweetbot.twitter_tweeting_start(days=0, hours=0, minutes=1, keywords=None, prefix=None, suffix='#PyGaze')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement