Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.86 KB | None | 0 0
  1. import praw
  2. import pdb
  3. import re
  4. import os
  5. import prawcore
  6. import random
  7. import time
  8. from praw.models import Message
  9.  
  10.  
  11.  
  12. reddit=praw.Reddit(client_id='',
  13.                    client_secret='',
  14.                    username='',
  15.                    password='',
  16.                    user_agent='')
  17.  
  18.  
  19. if not os.path.isfile("posts_replid_to.txt"):
  20.     posts_replid_to = []
  21. else:
  22.     with open("posts_replid_to.txt", "r") as f:
  23.         posts_replid_to = f.read()
  24.         posts_replid_to = posts_replid_to.split("\n")
  25.         posts_replid_to = list(filter(None, posts_replid_to))
  26.  
  27.  
  28. subreddit = reddit.subreddit('Memeeconomy')
  29. submissions = subreddit.stream.submissions()
  30.  
  31. for submission in submissions:
  32.     print (submission.created_utc)
  33.     submission.author_flair_text=str(submission.author_flair_text)
  34.  
  35.     if re.search("SOL Enterprises", submission.author_flair_text, re.IGNORECASE):
  36.         seconds=time.time()
  37.  
  38.         print (seconds)
  39.            
  40.         if submission.id not in posts_replid_to:
  41.             piet=seconds-submission.created_utc
  42.             print(piet)
  43.             if piet < 50:
  44.                 time.sleep(15)
  45.                 comments=submission.comments
  46.                 for comment in comments:
  47.                     if "MemeInvestor_bot" in comment.author.name:
  48.                         print("replying to {0}'s post".format(submission.author.name))  
  49.                         message1=('!invest 100%')
  50.                         comment.reply(message1)
  51.                         posts_replid_to.append(submission.id)
  52.                         with open("posts_replid_to.txt", "w") as f:
  53.                             for submission.id in posts_replid_to:
  54.                                 f.write(submission.id + "\n")
  55.                         time.sleep(14400)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement