remotes/1693045480750635534/spooky-22
Aevann1 2021-07-25 01:30:02 +02:00
parent 0a563cfaf7
commit 0c5b188c8f
3 changed files with 14 additions and 2 deletions

View File

@ -19,6 +19,18 @@ beams_client = PushNotifications(
secret_key=PUSHER_KEY,
)
@app.post("/@<username>/suicide")
@auth_required
def suicide(v, username):
t = int(time.time())
if v.admin_level == 0 and t - v.suicide_utc < 86400: return "", 204
user = get_user(username)
suicide = f"Hi there,\n\nA [concerned dramatard]({v.permalink}) reached out to us about you.\n\nWhen you're in the middle of something painful, it may feel like you don't have a lot of options. But whatever you're going through, you deserve help and there are people who are here for you.\n\nThere are resources available in your area that are free, confidential, and available 24/7:\n\n- Call, Text, or Chat with Canada's [Crisis Services Canada](https://www.crisisservicescanada.ca/en/)\n- Call, Email, or Visit the UK's [Samaritans](https://www.samaritans.org/)\n- Text CHAT to America's [Crisis Text Line](https://www.crisistextline.org/) at 741741.\nIf you don't see a resource in your area above, the moderators at r/SuicideWatch keep a comprehensive list of resources and hotlines for people organized by location. Find Someone Now\n\nIf you think you may be depressed or struggling in another way, don't ignore it or brush it aside. Take yourself and your feelings seriously, and reach out to someone.\n\nIt may not feel like it, but you have options. There are people available to listen to you, and ways to move forward.\n\nYour fellow dramatards care about you and there are people who want to help."
send_notification(1046, user, suicide)
v.suicide_utc = t
g.db.add(v)
return "", 204
@app.route("/api/v1/user/<username>", methods=["GET"])
@auth_desired
@api("read")

View File

@ -42,4 +42,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@ -44,4 +44,4 @@
</div>
</div>
</div>
</div>
</div>