From 307d18996784b164fd4058e6c07ef700d783891e Mon Sep 17 00:00:00 2001 From: lza_menace Date: Fri, 14 May 2021 00:40:01 -0700 Subject: [PATCH] add cli command to post to reddit for last x hours --- suchwow/app.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/suchwow/app.py b/suchwow/app.py index 3c8496c..000f6d6 100644 --- a/suchwow/app.py +++ b/suchwow/app.py @@ -91,6 +91,18 @@ def init(): # init db db.create_tables([Post, Profile, Comment, Notification, Moderator]) +@app.cli.command("post_reddit") +@click.argument('last_hours') +def post_reddit(last_hours): + posts = Post.select().where( + Post.approved==True, + Post.to_reddit==False + ).order_by(Post.timestamp.asc()) + for p in posts: + if p.hours_elapsed() < int(last_hours): + make_post(p) + return + @app.cli.command("create_accounts") def create_accounts(): wallet = wownero.Wallet()