mirror of
				https://github.com/simon987/opendirectories-bot.git
				synced 2025-10-31 06:16:51 +00:00 
			
		
		
		
	Should fix the double comment problem
This commit is contained in:
		
							parent
							
								
									d82e76387a
								
							
						
					
					
						commit
						56b28f534e
					
				
							
								
								
									
										14
									
								
								run.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								run.py
									
									
									
									
									
								
							| @ -12,7 +12,7 @@ subreddit = reddit.subreddit("opendirectories") | |||||||
| 
 | 
 | ||||||
| subs = [] | subs = [] | ||||||
| 
 | 
 | ||||||
| for submission in subreddit.new(limit=50): | for submission in subreddit.new(limit=3): | ||||||
|     subs.append(submission) |     subs.append(submission) | ||||||
| 
 | 
 | ||||||
| bot = RedditBot("crawled.txt") | bot = RedditBot("crawled.txt") | ||||||
| @ -47,11 +47,12 @@ def execute_task(submission): | |||||||
|                 print(com_string) |                 print(com_string) | ||||||
|                 while True: |                 while True: | ||||||
|                     try: |                     try: | ||||||
|                         submission.reply(com_string) |                         if not bot.has_crawled(submission.id): | ||||||
|                         bot.log_crawl(submission.id) |                             submission.reply(com_string) | ||||||
|  |                             bot.log_crawl(submission.id) | ||||||
|                         break |                         break | ||||||
|                     except Exception as e: |                     except Exception as e: | ||||||
|                         print("Waiting 5 minutes: " + str(e)) |                         print("Waiting 10 minutes: " + str(e)) | ||||||
|                         time.sleep(600) |                         time.sleep(600) | ||||||
|                         continue |                         continue | ||||||
| 
 | 
 | ||||||
| @ -67,17 +68,12 @@ while len(tq.tasks) > 0: | |||||||
|     if task is not None: |     if task is not None: | ||||||
|         if not bot.has_crawled(task.submission.id): |         if not bot.has_crawled(task.submission.id): | ||||||
|             p = Process(target=execute_task, args={task.submission}) |             p = Process(target=execute_task, args={task.submission}) | ||||||
|             p.daemon = True |  | ||||||
|             p.start() |             p.start() | ||||||
|             print("Started process for " + task.submission.title) |             print("Started process for " + task.submission.title) | ||||||
|         else: |         else: | ||||||
|             print("Already crawled " + task.submission) |             print("Already crawled " + task.submission) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| while True: |  | ||||||
|     time.sleep(1) |  | ||||||
|     print("Waiting..") |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user