suicide 2

master
Aevann1 2021-07-24 21:58:40 +02:00
parent e185e623b6
commit b74f824dfb
3 changed files with 8 additions and 5 deletions

View File

@ -38,6 +38,7 @@ class User(Base, Stndrd, Age_times):
passhash = deferred(Column(String, default=None))
banawards = Column(Integer, default=0)
created_utc = Column(Integer, default=0)
suicide_utc = Column(Integer, default=0)
admin_level = Column(Integer, default=0)
resized = Column(Boolean, default=True)
agendaposter = Column(Boolean, default=False)

View File

@ -1,7 +1,6 @@
from urllib.parse import urlparse
import mistletoe
import urllib.parse
import threading
import gevent
from drama.helpers.wrappers import *
@ -23,7 +22,8 @@ from PIL import Image as PILimage
with open("snappy.txt", "r") as f:
snappyquotes = f.read().split("{[para]}")
def resize():
@app.route("/resize")
def resize()
u = g.db.query(User).filter(User.profileurl != None, User.resized != True).first()
print(u.username)
print(f"1 {u.profileurl}")
@ -44,7 +44,6 @@ def resize():
g.db.add(u)
print(f"2 {u.profileurl}")
@app.route("/banaward/post/<post_id>")
@auth_required
def postbanaward(post_id, v):
@ -95,8 +94,6 @@ def submit_get(v):
if v and v.is_banned and not v.unban_utc: return render_template("seized.html")
b = get_guild("general")
resize()
return render_template("submit.html",
v=v,

View File

@ -1,6 +1,7 @@
import qrcode
import io
from datetime import datetime
from time import time
from drama.classes.user import ViewerRelationship
from drama.helpers.alerts import *
@ -21,6 +22,8 @@ beams_client = PushNotifications(
@app.route("/@<username>/suicide")
@auth_required
def suicide(v, username):
t = int(time())
if t - v.suicide_utc < 86400: abort(403)
user = get_user(username)
suicide = f"""Hi there,
@ -41,6 +44,8 @@ def suicide(v, username):
Your 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"])