diff --git a/files/helpers/actions.py b/files/helpers/actions.py index 3fc6d3964..5094582b4 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -191,3 +191,91 @@ def execute_snappy(post, v): post.comment_count += 1 post.replies = [c] + +def execute_zozbot(c, level, parent_submission, v): + if random.random() >= 0.001: return + c2 = Comment(author_id=ZOZBOT_ID, + parent_submission=parent_submission, + parent_comment_id=c.id, + level=level+1, + is_bot=True, + body="zoz", + body_html="
zoz
", + top_comment_id=c.top_comment_id, + ghost=c.ghost, + distinguish_level=6 + ) + + g.db.add(c2) + g.db.flush() + n = Notification(comment_id=c2.id, user_id=v.id) + g.db.add(n) + + c3 = Comment(author_id=ZOZBOT_ID, + parent_submission=parent_submission, + parent_comment_id=c2.id, + level=level+2, + is_bot=True, + body="zle", + body_html="zle
", + top_comment_id=c.top_comment_id, + ghost=c.ghost, + distinguish_level=6 + ) + + g.db.add(c3) + g.db.flush() + + + c4 = Comment(author_id=ZOZBOT_ID, + parent_submission=parent_submission, + parent_comment_id=c3.id, + level=level+3, + is_bot=True, + body="zozzle", + body_html="zozzle
", + top_comment_id=c.top_comment_id, + ghost=c.ghost, + distinguish_level=6 + ) + + g.db.add(c4) + + zozbot = get_account(ZOZBOT_ID) + zozbot.comment_count += 3 + zozbot.coins += 3 + g.db.add(zozbot) + +def execute_longpostbot(c, level, body, body_html, parent_submission, v): + if not len(c.body.split()) >= 200 and "<" not in body and "" not in body_html: return + body = random.choice(LONGPOST_REPLIES) + if body.startswith('▼'): + body = body[1:] + vote = CommentVote(user_id=LONGPOSTBOT_ID, + vote_type=-1, + comment_id=c.id, + real = True + ) + g.db.add(vote) + c.downvotes = 1 + + c2 = Comment(author_id=LONGPOSTBOT_ID, + parent_submission=parent_submission, + parent_comment_id=c.id, + level=level+1, + is_bot=True, + body=body, + body_html=f"{body}
", + top_comment_id=c.top_comment_id, + ghost=c.ghost + ) + + g.db.add(c2) + + longpostbot = get_account(LONGPOSTBOT_ID) + longpostbot.comment_count += 1 + longpostbot.coins += 1 + g.db.add(longpostbot) + g.db.flush() + n = Notification(comment_id=c2.id, user_id=v.id) + g.db.add(n) \ No newline at end of file diff --git a/files/routes/comments.py b/files/routes/comments.py index a24d22fac..e6729e03c 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -409,101 +409,9 @@ def comment(v): n = Notification(comment_id=c_jannied.id, user_id=v.id) g.db.add(n) - - if SITE_NAME == 'rDrama' and len(c.body.split()) >= 200 and "<" not in body and "" not in body_html: - - body = random.choice(LONGPOST_REPLIES) - - - if body.startswith('▼'): - body = body[1:] - vote = CommentVote(user_id=LONGPOSTBOT_ID, - vote_type=-1, - comment_id=c.id, - real = True - ) - g.db.add(vote) - c.downvotes = 1 - - - c2 = Comment(author_id=LONGPOSTBOT_ID, - parent_submission=parent_submission, - parent_comment_id=c.id, - level=level+1, - is_bot=True, - body=body, - body_html=f"{body}
", - top_comment_id=c.top_comment_id, - ghost=c.ghost - ) - - g.db.add(c2) - - longpostbot = get_account(LONGPOSTBOT_ID) - longpostbot.comment_count += 1 - longpostbot.coins += 1 - g.db.add(longpostbot) - - g.db.flush() - - n = Notification(comment_id=c2.id, user_id=v.id) - g.db.add(n) - - - if SITE_NAME == 'rDrama' and random.random() < 0.001: - c2 = Comment(author_id=ZOZBOT_ID, - parent_submission=parent_submission, - parent_comment_id=c.id, - level=level+1, - is_bot=True, - body="zoz", - body_html="zoz
", - top_comment_id=c.top_comment_id, - ghost=c.ghost, - distinguish_level=6 - ) - - g.db.add(c2) - g.db.flush() - n = Notification(comment_id=c2.id, user_id=v.id) - g.db.add(n) - - - - c3 = Comment(author_id=ZOZBOT_ID, - parent_submission=parent_submission, - parent_comment_id=c2.id, - level=level+2, - is_bot=True, - body="zle", - body_html="zle
", - top_comment_id=c.top_comment_id, - ghost=c.ghost, - distinguish_level=6 - ) - - g.db.add(c3) - g.db.flush() - - - c4 = Comment(author_id=ZOZBOT_ID, - parent_submission=parent_submission, - parent_comment_id=c3.id, - level=level+3, - is_bot=True, - body="zozzle", - body_html="zozzle
", - top_comment_id=c.top_comment_id, - ghost=c.ghost, - distinguish_level=6 - ) - - g.db.add(c4) - - zozbot = get_account(ZOZBOT_ID) - zozbot.comment_count += 3 - zozbot.coins += 3 - g.db.add(zozbot) + if SITE_NAME == 'rDrama': + execute_longpostbot(c, level, body, body_html, parent_submission, v) + execute_zozbot(c, level, parent_submission, v) if not v.shadowbanned: notify_users = NOTIFY_USERS(body, v)