add cli command to post to reddit for last x hours

pull/4/head
lza_menace 3 years ago
parent 490082cc09
commit 307d189967

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