add cli command to post to reddit for last x hours

This commit is contained in:
lza_menace 2021-05-14 00:40:01 -07:00
parent 490082cc09
commit 307d189967

View file

@ -91,6 +91,18 @@ def init():
# init db # init db
db.create_tables([Post, Profile, Comment, Notification, Moderator]) 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") @app.cli.command("create_accounts")
def create_accounts(): def create_accounts():
wallet = wownero.Wallet() wallet = wownero.Wallet()