From f53f8381ee7cd0ee147398ddff768e9422341149 Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Sun, 16 May 2021 13:59:09 -0400 Subject: [PATCH] Limit description to <2048 characters --- src/gitea_command.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gitea_command.rs b/src/gitea_command.rs index bf9fe5a..712e578 100644 --- a/src/gitea_command.rs +++ b/src/gitea_command.rs @@ -34,11 +34,16 @@ pub fn gitea_release(interaction: &Interaction) -> InteractionResponse { asset_str += &format!("[{}]({})\n", f.name, f.browser_download_url); } } + // limit description to 2000 characters + let mut desc = release.body.clone(); + if desc.len() > 2000 { + desc = desc[..2000].to_string() + "..."; + } // assemble embed let embed = Embed { title: Some(format!("{} {}", &repo_name, &release.tag_name)), type_: None, - description: Some(release.body.clone()), + description: Some(desc), url: None, timestamp: None, color: Some(0x00C800), // Colour::from_rgb(0, 200, 0)