From 6b04324ee548dd80e276599462b08f64185bcbb0 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 2 Jun 2024 12:29:49 +0100 Subject: [PATCH] Limit text length sent to discord webhook --- app/tasks/webhooktasks.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/tasks/webhooktasks.py b/app/tasks/webhooktasks.py index 52252c08..4879c3f5 100644 --- a/app/tasks/webhooktasks.py +++ b/app/tasks/webhooktasks.py @@ -30,11 +30,11 @@ def post_discord_webhook(username: Optional[str], content: str, is_queue: bool, return json = { - "content": content, + "content": content[0:2000], } if username: - json["username"] = username + json["username"] = username[0:80] user = User.query.filter_by(username=username).first() if user: 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: embed = { - "title": title, - "description": description, + "title": title[0:256], + "description": description[0:4000], } if thumbnail: