Limit text length sent to discord webhook

This commit is contained in:
rubenwardy 2024-06-02 12:29:49 +01:00
parent 8db31ebfa9
commit 6b04324ee5

@ -30,11 +30,11 @@ def post_discord_webhook(username: Optional[str], content: str, is_queue: bool,
return return
json = { json = {
"content": content, "content": content[0:2000],
} }
if username: if username:
json["username"] = username json["username"] = username[0:80]
user = User.query.filter_by(username=username).first() user = User.query.filter_by(username=username).first()
if user: if user:
json["avatar_url"] = user.get_profile_pic_url().replace("/./", "/") json["avatar_url"] = user.get_profile_pic_url().replace("/./", "/")
@ -43,8 +43,8 @@ def post_discord_webhook(username: Optional[str], content: str, is_queue: bool,
if title: if title:
embed = { embed = {
"title": title, "title": title[0:256],
"description": description, "description": description[0:4000],
} }
if thumbnail: if thumbnail: