Browse Source

Limit description to <2048 characters

master
NGnius (Graham) 3 years ago
parent
commit
f53f8381ee
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      src/gitea_command.rs

+ 6
- 1
src/gitea_command.rs View File

@@ -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)


Loading…
Cancel
Save