Advertisement
bradenlance

my_first_bot.py

Dec 7th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. import os
  2. import time
  3. from Random_select import Tweet
  4. from mkb import MarkovBot
  5. tweetbot = MarkovBot()
  6.  
  7. #import markovbot
  8. #tweetbot = markovbot.MarkovBot()
  9.  
  10.  
  11. # Get the current directory's path
  12. dirname = os.path.dirname(os.path.abspath('twitterbot'))
  13. # Construct the path to the book
  14. book = os.path.join(dirname, 'frankocean.txt')
  15. # Make your bot read the book!
  16. tweetbot.read(book)
  17.  
  18. #my_first_text = tweetbot.generate_text(25, seedword=['dream', 'psychoanalysis'])
  19. #print("tweetbot says:")
  20. #print(my_first_text)
  21.  
  22. # ALL YOUR SECRET STUFF!
  23. # Consumer Key (API Key)
  24. cons_key = '**********'
  25. # Consumer Secret (API Secret)
  26. cons_secret = '**********'
  27. # Access Token
  28. access_token = '**************'
  29. # Access Token Secret
  30. access_token_secret = '****************'
  31.  
  32. def randomSuffix():
  33.     lst = []
  34.     for i in range(100):
  35.         lst.append(Tweet())
  36.     return lst
  37.  
  38. # Log in to Twitter
  39. tweetbot.twitter_login(cons_key, cons_secret, access_token, access_token_secret)
  40.  
  41. tweetbot.twitter_tweeting_start(days=0, hours=0, minutes=15, keywords=None, prefix= 'Local Cincinnati boy', suffix=randomSuffix())
  42.  
  43. secsinweek = 7 * 24 * 60 * 60
  44. day = secsinweek / 7
  45. time.sleep(day)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement