mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-14 18:11:23 +01:00
Webhook truncate username if too long
This commit is contained in:
parent
88a3f4c51c
commit
286f395b72
@ -143,10 +143,13 @@ def get_channel_webhook_url(guild_id, channel_id):
|
|||||||
dbguild = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first()
|
dbguild = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first()
|
||||||
guild_webhooks = json.loads(dbguild.webhooks)
|
guild_webhooks = json.loads(dbguild.webhooks)
|
||||||
name = "[Titan] "
|
name = "[Titan] "
|
||||||
|
username = session["username"]
|
||||||
|
if len(username) > 19:
|
||||||
|
username = username[:19]
|
||||||
if user_unauthenticated():
|
if user_unauthenticated():
|
||||||
name = name + session["username"] + "#" + str(session["user_id"])
|
name = name + username + "#" + str(session["user_id"])
|
||||||
else:
|
else:
|
||||||
name = name + session["username"] + "#" + str(session["discriminator"])
|
name = name + username + "#" + str(session["discriminator"])
|
||||||
for webhook in guild_webhooks:
|
for webhook in guild_webhooks:
|
||||||
if channel_id == webhook["channel_id"] and webhook["name"] == name:
|
if channel_id == webhook["channel_id"] and webhook["name"] == name:
|
||||||
return {
|
return {
|
||||||
|
@ -52,10 +52,13 @@ class Gateway(Namespace):
|
|||||||
dbguild = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first()
|
dbguild = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first()
|
||||||
guild_webhooks = json.loads(dbguild.webhooks)
|
guild_webhooks = json.loads(dbguild.webhooks)
|
||||||
name = "[Titan] "
|
name = "[Titan] "
|
||||||
|
username = session["username"]
|
||||||
|
if len(username) > 19:
|
||||||
|
username = username[:19]
|
||||||
if session["unauthenticated"]:
|
if session["unauthenticated"]:
|
||||||
name = name + session["username"] + "#" + str(session["user_id"])
|
name = name + username + "#" + str(session["user_id"])
|
||||||
else:
|
else:
|
||||||
name = name + session["username"] + "#" + str(session["discriminator"])
|
name = name + username + "#" + str(session["discriminator"])
|
||||||
for webhook in guild_webhooks:
|
for webhook in guild_webhooks:
|
||||||
if webhook["name"] == name:
|
if webhook["name"] == name:
|
||||||
discord_api.delete_webhook(webhook["id"], webhook["token"])
|
discord_api.delete_webhook(webhook["id"], webhook["token"])
|
||||||
|
Loading…
Reference in New Issue
Block a user