Give me a notification whenever one of the other jannies removes a post or comment

master
Aevann1 2022-05-30 05:01:03 +02:00
parent aff30db1fe
commit b2c011a7ba
1 changed files with 9 additions and 0 deletions

View File

@ -1271,6 +1271,10 @@ def ban_post(post_id, v):
v.coins += 1 v.coins += 1
g.db.add(v) g.db.add(v)
if SITE == 'rdrama.net' and v.id != AEVANN_ID:
message = f"@{v.username} has removed [{post.title}]({post.shortlink})"
send_repeatable_notification(AEVANN_ID, message)
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, json={'files': [f"{SITE_FULL}/logged_out/"]}, timeout=5) requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, json={'files': [f"{SITE_FULL}/logged_out/"]}, timeout=5)
g.db.commit() g.db.commit()
@ -1473,6 +1477,11 @@ def api_ban_comment(c_id, v):
target_comment_id=comment.id, target_comment_id=comment.id,
) )
g.db.add(ma) g.db.add(ma)
if SITE == 'rdrama.net' and v.id != AEVANN_ID:
message = f"@{v.username} has removed [comment]({comment.shortlink})"
send_repeatable_notification(AEVANN_ID, message)
g.db.commit() g.db.commit()
return {"message": "Comment removed!"} return {"message": "Comment removed!"}