|
|
|
@ -9,7 +9,7 @@ from suchwow import config
|
|
|
|
|
from suchwow.models import Post, Profile, Comment, Notification, db
|
|
|
|
|
from suchwow.routes import auth, comment, post, profile, leaderboard
|
|
|
|
|
from suchwow.utils.decorators import login_required
|
|
|
|
|
from suchwow.reddit import Reddit
|
|
|
|
|
from suchwow.reddit import make_post
|
|
|
|
|
from suchwow import wownero
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -72,13 +72,7 @@ def reddit_recent():
|
|
|
|
|
diff = datetime.now() - post.timestamp
|
|
|
|
|
recent_post = diff < timedelta(hours=2)
|
|
|
|
|
if recent_post:
|
|
|
|
|
title = f"[SuchWow!][{post.submitter}][#{post.id}] {post.title}"
|
|
|
|
|
url = url_for("post.read", id=post.id)
|
|
|
|
|
reddit_post = Reddit().post(title, url)
|
|
|
|
|
post.reddit_url = reddit_post.url
|
|
|
|
|
post.save()
|
|
|
|
|
print(f"Posted #{post.id} to Reddit - {reddit_post.url}")
|
|
|
|
|
return True
|
|
|
|
|
make_post(post)
|
|
|
|
|
|
|
|
|
|
@app.cli.command("reddit_random")
|
|
|
|
|
def reddit_random():
|
|
|
|
@ -86,21 +80,7 @@ def reddit_random():
|
|
|
|
|
wallet = wownero.Wallet()
|
|
|
|
|
all_posts = Post.select().where(Post.reddit_url == None)
|
|
|
|
|
post = choice(all_posts)
|
|
|
|
|
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}")
|
|
|
|
|
return True
|
|
|
|
|
make_post(post)
|
|
|
|
|
|
|
|
|
|
@app.cli.command("payout_users")
|
|
|
|
|
def payout_users():
|
|
|
|
|