Limit usernames to 25 characters

This commit is contained in:
Jeremy Zhang 2019-01-16 18:00:36 +00:00
parent bb10944052
commit 5c04dffb0d

View File

@ -311,7 +311,10 @@ def post():
# content = "(Titan Dev) " + content # content = "(Titan Dev) " + content
if webhook: if webhook:
if (session['unauthenticated']): if (session['unauthenticated']):
username = session["username"] + "#" + str(session["user_id"]) username = session["username"]
if len(username) > 25:
username = username[:25]
username = username + "#" + str(session["user_id"])
avatar = url_for('static', filename='img/titanembeds_square.png', _external=True) avatar = url_for('static', filename='img/titanembeds_square.png', _external=True)
dbguild = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first() dbguild = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first()
if dbguild: if dbguild:
@ -326,6 +329,8 @@ def post():
# if content.startswith("(Titan Dev) "): # if content.startswith("(Titan Dev) "):
# content = content[12:] # content = content[12:]
# username = "(Titan Dev) " + username # username = "(Titan Dev) " + username
if len(username) > 25:
username = username[:25]
username = username + "#" + str(session['discriminator']) username = username + "#" + str(session['discriminator'])
avatar = session['avatar'] avatar = session['avatar']
message = discord_api.execute_webhook(webhook.get("id"), webhook.get("token"), username, avatar, content, file) message = discord_api.execute_webhook(webhook.get("id"), webhook.get("token"), username, avatar, content, file)