Advertisement
Guest User

Untitled

a guest
Feb 7th, 2018
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.56 KB | None | 0 0
  1. import praw
  2. import time
  3.  
  4. def run():
  5.     print('Logging Into Reddit...')
  6.     #Create Bot with login and private key - username - password
  7.     bot = praw.Reddit(user_agent='AppNana Post Scheduler Bot v0.1', client_id='xyNB7BJhkza4hQ', client_secret='fNGdPVgk-WaPUqJvMEEKkauH8YY',
  8.         username='ReiSixx9', password='')
  9.     print('Logged in and running.')
  10.  
  11.     sub_list = ['AppNana', 'AppNanas', 'AppNana_Codes', 'Appnana_4_everybody', 'AppNanaCodeHack', 'AppnanaMoney', 'Appnanacodeexchange', 'AppnanaInviteCodes']
  12.     title = "d25367499"
  13.     message = ''
  14.     i=0             #A counter for Number of loops (10 minutes)
  15.     while 1:
  16.         #post once per 10 minutes, post AppNana once per two hours, AppNanaCodeHack once per day
  17.  
  18.         for sub in sub_list:
  19.             if sub == 'AppNana':
  20.                 if i % 12 == 0:        #every 120 minutes, post
  21.                     redditpost(sub, title, message)
  22.                     time.sleep(600)
  23.                 else:
  24.                     continue
  25.             elif sub == 'AppNana_Codes':
  26.                 if i % 144 == 0:       #every 1440 minutes, post (24 hours)
  27.                     redditpost(sub, title, message)
  28.                     time.sleep(600)
  29.                 else:
  30.                     continue
  31.             else:
  32.                 redditpost(sub, title, message)
  33.                 time.sleep(600)
  34.             i+=1        #
  35.  
  36. def redditpost(bot, sub, title, message):
  37.     bot.subreddit(sub).submit(title, message)                   #Code for submitting new post on Reddit
  38.  
  39. if __name__ == '__main__':
  40.     run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement