add another db toggle for discord

This commit is contained in:
lza_menace 2020-10-29 01:13:02 -07:00
parent 7d7caf803d
commit 59ece469a5
2 changed files with 2 additions and 1 deletions

View file

@ -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)

View file

@ -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