mirror of
				https://git.wownero.com/lza_menace/suchwow.git
				synced 2024-08-15 01:03:19 +00:00 
			
		
		
		
	add another db toggle for discord
This commit is contained in:
		
							parent
							
								
									7d7caf803d
								
							
						
					
					
						commit
						59ece469a5
					
				
					 2 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
					@ -72,7 +72,7 @@ def create_accounts():
 | 
				
			||||||
@app.cli.command("post_new_memes")
 | 
					@app.cli.command("post_new_memes")
 | 
				
			||||||
def post_new_memes():
 | 
					def post_new_memes():
 | 
				
			||||||
    # run every 5 mins
 | 
					    # run every 5 mins
 | 
				
			||||||
    all_posts = Post.select().order_by(Post.timestamp.desc()).where(Post.to_reddit == False)
 | 
					    all_posts = Post.select().order_by(Post.timestamp.desc()).where(Post.to_reddit == False, Post.to_discord == False)
 | 
				
			||||||
    for post in all_posts:
 | 
					    for post in all_posts:
 | 
				
			||||||
        diff = datetime.now() - post.timestamp
 | 
					        diff = datetime.now() - post.timestamp
 | 
				
			||||||
        recent_post = diff < timedelta(hours=2)
 | 
					        recent_post = diff < timedelta(hours=2)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,6 +18,7 @@ class Post(Model):
 | 
				
			||||||
    timestamp = DateTimeField(default=datetime.now)
 | 
					    timestamp = DateTimeField(default=datetime.now)
 | 
				
			||||||
    reddit_url = CharField(null=True)
 | 
					    reddit_url = CharField(null=True)
 | 
				
			||||||
    to_reddit = BooleanField(default=False)
 | 
					    to_reddit = BooleanField(default=False)
 | 
				
			||||||
 | 
					    to_discord = BooleanField(default=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    class Meta:
 | 
					    class Meta:
 | 
				
			||||||
        database = db
 | 
					        database = db
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue