Aevann 2023-03-18 12:59:30 +02:00
parent 8e923ffe05
commit 49d958ef46
2 changed files with 16 additions and 5 deletions

View File

@ -44,6 +44,12 @@ def archive_url(url):
url = url.replace('https://instagram.com/p/', 'https://imginn.com/p/')
gevent.spawn(_archiveorg, url)
def snappy_report(post, reason):
flag = Flag(post_id=post.id, user_id=SNAPPY_ID, reason=reason)
g.db.add(flag)
message = f'@Snappy reported [{post.title}]({post.shortlink})\n\n> {reason}'
send_repeatable_notification(post.author_id, message)
def execute_snappy(post:Submission, v:User):
ghost = post.ghost
@ -77,11 +83,9 @@ def execute_snappy(post:Submission, v:User):
g.db.add(vote)
post.downvotes += 1
if body.startswith('OP is a Trump supporter'):
flag = Flag(post_id=post.id, user_id=SNAPPY_ID, reason='Trump supporter')
g.db.add(flag)
snappy_report(post, 'Trump supporter')
elif body.startswith('You had your chance. Downvoted and reported'):
flag = Flag(post_id=post.id, user_id=SNAPPY_ID, reason='Retard')
g.db.add(flag)
snappy_report(post, 'Retard')
elif body.startswith('') or body.startswith(':#marseyupvote'):
if body.startswith(''): body = body[1:]
vote = Vote(user_id=SNAPPY_ID,

View File

@ -65,6 +65,10 @@ def flag_post(pid, v):
flag = Flag(post_id=post.id, user_id=v.id, reason=reason)
g.db.add(flag)
if v.id != post.author_id:
message = f'@{v.username} reported [{post.title}]({post.shortlink})\n\n> {reason}'
send_repeatable_notification(post.author_id, message)
return {"message": "Post reported!"}
@ -89,9 +93,12 @@ def flag_comment(cid, v):
if len(reason) > 350: abort(400, "Too long!")
flag = CommentFlag(comment_id=comment.id, user_id=v.id, reason=reason)
g.db.add(flag)
if v.id != comment.author_id:
message = f'@{v.username} reported your [comment]({comment.shortlink})\n\n> {reason}'
send_repeatable_notification(comment.author_id, message)
return {"message": "Comment reported!"}