forked from MarseyWorld/MarseyWorld
parent
8e923ffe05
commit
49d958ef46
|
@ -44,6 +44,12 @@ def archive_url(url):
|
||||||
url = url.replace('https://instagram.com/p/', 'https://imginn.com/p/')
|
url = url.replace('https://instagram.com/p/', 'https://imginn.com/p/')
|
||||||
gevent.spawn(_archiveorg, url)
|
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):
|
def execute_snappy(post:Submission, v:User):
|
||||||
ghost = post.ghost
|
ghost = post.ghost
|
||||||
|
|
||||||
|
@ -77,11 +83,9 @@ def execute_snappy(post:Submission, v:User):
|
||||||
g.db.add(vote)
|
g.db.add(vote)
|
||||||
post.downvotes += 1
|
post.downvotes += 1
|
||||||
if body.startswith('OP is a Trump supporter'):
|
if body.startswith('OP is a Trump supporter'):
|
||||||
flag = Flag(post_id=post.id, user_id=SNAPPY_ID, reason='Trump supporter')
|
snappy_report(post, 'Trump supporter')
|
||||||
g.db.add(flag)
|
|
||||||
elif body.startswith('You had your chance. Downvoted and reported'):
|
elif body.startswith('You had your chance. Downvoted and reported'):
|
||||||
flag = Flag(post_id=post.id, user_id=SNAPPY_ID, reason='Retard')
|
snappy_report(post, 'Retard')
|
||||||
g.db.add(flag)
|
|
||||||
elif body.startswith('▲') or body.startswith(':#marseyupvote'):
|
elif body.startswith('▲') or body.startswith(':#marseyupvote'):
|
||||||
if body.startswith('▲'): body = body[1:]
|
if body.startswith('▲'): body = body[1:]
|
||||||
vote = Vote(user_id=SNAPPY_ID,
|
vote = Vote(user_id=SNAPPY_ID,
|
||||||
|
|
|
@ -65,6 +65,10 @@ def flag_post(pid, v):
|
||||||
flag = Flag(post_id=post.id, user_id=v.id, reason=reason)
|
flag = Flag(post_id=post.id, user_id=v.id, reason=reason)
|
||||||
g.db.add(flag)
|
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!"}
|
return {"message": "Post reported!"}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,9 +93,12 @@ def flag_comment(cid, v):
|
||||||
if len(reason) > 350: abort(400, "Too long!")
|
if len(reason) > 350: abort(400, "Too long!")
|
||||||
|
|
||||||
flag = CommentFlag(comment_id=comment.id, user_id=v.id, reason=reason)
|
flag = CommentFlag(comment_id=comment.id, user_id=v.id, reason=reason)
|
||||||
|
|
||||||
g.db.add(flag)
|
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!"}
|
return {"message": "Comment reported!"}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue