forked from MarseyWorld/MarseyWorld
move zozbot and longpostbot into the actions helpers
parent
87fd8ee57a
commit
63c7fe0c29
|
@ -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="<p>zoz</p>",
|
||||
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="<p>zle</p>",
|
||||
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="<p>zozzle</p>",
|
||||
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 "</blockquote>" 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"<p>{body}</p>",
|
||||
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)
|
|
@ -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 "</blockquote>" 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"<p>{body}</p>",
|
||||
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="<p>zoz</p>",
|
||||
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="<p>zle</p>",
|
||||
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="<p>zozzle</p>",
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue