master
Aevann1 2021-09-01 22:51:47 +02:00
parent 48b7ed8dfb
commit 4394021b66
3 changed files with 119 additions and 2 deletions

View File

@ -44,6 +44,17 @@ AGENDAPOSTER_MSG = """Hi {username},\n\nYour comment has been automatically remo
included. \n\n*This is an automated message; if you need help, included. \n\n*This is an automated message; if you need help,
you can message us [here](/contact).*""" you can message us [here](/contact).*"""
VAXX_MSG = """Hi {username}, it appears that you may be trying to spread dangerous misinformation regarding ineffective COVID-19 treatments based on pseudoscientific hearsay. Your post has been removed because it contained the word ivermectin. We ask that you understand that horse dewormer neither treats, nor prevents, COVID-19. For more information, please read up on what the FDA has to say on the matter:
https://www.fda.gov/consumers/consumer-updates/why-you-should-not-use-ivermectin-treat-or-prevent-covid-19
COVID-19 is not a joke, it is a global pandemic and it has been hard on all of us. It will likely go down as one of the most defining periods of our generation. Many of us have lost loved ones to the virus. It has caused confusion, fear, frustration, and served to further divide us. Tens of millions around the world have died. There is nothing to be gained by spreading bad science based on very understandable fear.
The only proven method of prevention is the COVID-19 vaccine, paired with appropriate social distancing, handwashing, and masks. Vaccines are free in the United States - if you'd like to locate your nearest vaccine provider, please visit https://www.vaccines.gov/ and schedule an appointment today.
Thank you."""
NOTIFICATIONS_ACCOUNT = 1046 NOTIFICATIONS_ACCOUNT = 1046
AUTOJANNY_ACCOUNT = 2360 AUTOJANNY_ACCOUNT = 2360

View File

@ -293,6 +293,40 @@ def api_comment(v):
g.db.add(c_aux) g.db.add(c_aux)
g.db.flush() g.db.flush()
if "ivermectin" in c_aux.body_html.lower():
c.is_banned = True
c.ban_reason = "ToS Violation"
g.db.add(c)
c_jannied = Comment(author_id=AUTOJANNY_ACCOUNT,
parent_submission=parent_submission,
distinguish_level=6,
parent_comment_id=c.id,
level=level+1,
is_bot=True,
)
g.db.add(c_jannied)
g.db.flush()
body = VAXX_MSG.format(username=v.username)
with CustomRenderer(post_id=parent_id) as renderer:
body_md = renderer.render(mistletoe.Document(body))
body_jannied_html = sanitize(body_md)
c_aux = CommentAux(
id=c_jannied.id,
body_html=body_jannied_html,
body=body
)
g.db.add(c_aux)
g.db.flush()
n = Notification(comment_id=c_jannied.id, user_id=v.id)
g.db.add(n)
if v.agendaposter and "trans lives matter" not in c_aux.body_html.lower(): if v.agendaposter and "trans lives matter" not in c_aux.body_html.lower():
c.is_banned = True c.is_banned = True
@ -313,7 +347,6 @@ def api_comment(v):
body = AGENDAPOSTER_MSG.format(username=v.username) body = AGENDAPOSTER_MSG.format(username=v.username)
#body = body.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n")
with CustomRenderer(post_id=parent_id) as renderer: with CustomRenderer(post_id=parent_id) as renderer:
body_md = renderer.render(mistletoe.Document(body)) body_md = renderer.render(mistletoe.Document(body))
@ -630,6 +663,41 @@ def edit_comment(cid, v):
c.body = body[:10000] c.body = body[:10000]
c.body_html = body_html[:20000] c.body_html = body_html[:20000]
if "ivermectin" in c.body_html.lower():
c.is_banned = True
c.ban_reason = "ToS Violation"
g.db.add(c)
c_jannied = Comment(author_id=AUTOJANNY_ACCOUNT,
parent_submission=c.parent_submission,
distinguish_level=6,
parent_comment_id=c.id,
level=c.level+1,
is_bot=True,
)
g.db.add(c_jannied)
g.db.flush()
body = VAXX_MSG.format(username=v.username)
with CustomRenderer(post_id=c.parent_submission) as renderer:
body_md = renderer.render(mistletoe.Document(body))
body_jannied_html = sanitize(body_md)
c_aux = CommentAux(
id=c_jannied.id,
body_html=body_jannied_html[:20000],
body=body[:10000]
)
g.db.add(c_aux)
g.db.flush()
n = Notification(comment_id=c_jannied.id, user_id=v.id)
g.db.add(n)
if v.agendaposter and "trans lives matter" not in c.body_html.lower(): if v.agendaposter and "trans lives matter" not in c.body_html.lower():
c.is_banned = True c.is_banned = True

View File

@ -310,7 +310,7 @@ def edit_post(pid, v):
g.db.add(c_jannied) g.db.add(c_jannied)
g.db.flush() g.db.flush()
body = AGENDAPOSTER_MSG.format(username=v.username) body = VAXX_MSG.format(username=v.username)
with CustomRenderer(post_id=p.id) as renderer: with CustomRenderer(post_id=p.id) as renderer:
body_md = renderer.render(mistletoe.Document(body)) body_md = renderer.render(mistletoe.Document(body))
@ -870,6 +870,44 @@ def submit_post(v):
g.db.add(new_post) g.db.add(new_post)
g.db.flush() g.db.flush()
if "ivermectin" in new_post_aux.body_html.lower():
new_post.is_banned = True
new_post.ban_reason = "ToS Violation"
g.db.add(new_post)
c_jannied = Comment(author_id=AUTOJANNY_ACCOUNT,
parent_submission=new_post.id,
level=1,
over_18=False,
is_bot=True,
app_id=None,
is_pinned=True,
distinguish_level=6
)
g.db.add(c_jannied)
g.db.flush()
body = VAXX_MSG.format(username=v.username)
with CustomRenderer(post_id=new_post.id) as renderer:
body_md = renderer.render(mistletoe.Document(body))
body_jannied_html = sanitize(body_md)
c_aux = CommentAux(
id=c_jannied.id,
body_html=body_jannied_html,
body=body
)
g.db.add(c_aux)
g.db.flush()
n = Notification(comment_id=c_jannied.id, user_id=v.id)
g.db.add(n)
if v.agendaposter and "trans lives matter" not in new_post_aux.body_html.lower(): if v.agendaposter and "trans lives matter" not in new_post_aux.body_html.lower():
new_post.is_banned = True new_post.is_banned = True