|
|
|
@ -83,11 +83,20 @@ def reddit_recent():
|
|
|
|
|
@app.cli.command("reddit_random")
|
|
|
|
|
def reddit_random():
|
|
|
|
|
# run every 8 hours
|
|
|
|
|
wallet = wownero.Wallet()
|
|
|
|
|
all_posts = Post.select().where(Post.reddit_url == None)
|
|
|
|
|
post = choice(all_posts)
|
|
|
|
|
title = f"[SuchWow!][{post.submitter}][#{post.id}] {post.title}"
|
|
|
|
|
url = url_for("post.read", id=post.id)
|
|
|
|
|
title = f"SuchWow #{post.id} - {post.title}"
|
|
|
|
|
url = url_for('post.uploaded_file', filename=post.image_name)
|
|
|
|
|
_comment = [
|
|
|
|
|
f"'{post.text}'\n\nSubmitter: {post.submitter}\n",
|
|
|
|
|
f"Timestamp (UTC): {post.timestamp}\n",
|
|
|
|
|
"\nShow this poster some love by sending WOW to the following address: ",
|
|
|
|
|
f"{wallet.get_address(account=post.account_index)}"
|
|
|
|
|
]
|
|
|
|
|
comment = "".join(_comment)
|
|
|
|
|
reddit_post = Reddit().post(title, url)
|
|
|
|
|
reddit_comment = Reddit().comment(reddit_post, comment)
|
|
|
|
|
post.reddit_url = reddit_post.url
|
|
|
|
|
post.save()
|
|
|
|
|
print(f"Posted #{post.id} to Reddit - {reddit_post.url}")
|
|
|
|
|