Переглянути джерело

Improve issue details embed

master
NGnius (Graham) 3 роки тому
джерело
коміт
a7325137a0
1 змінених файлів з 20 додано та 8 видалено
  1. +20
    -8
      src/gitea_command.rs

+ 20
- 8
src/gitea_command.rs Переглянути файл

@@ -123,8 +123,15 @@ pub fn gitea_issue(interaction: &Interaction) -> InteractionResponse {
if desc.len() > 2000 {
desc = desc[..2000].to_string() + "...";
}
// build tags field
let mut tags = Vec::new();
for t in resp.labels {
tags.push(format!("{}", &t.name));
}
let tag_str = tags.join(", ");
// build embed
let embed = Embed {
title: Some(format!("{} #{}", &repo_name, index)),
title: Some(format!("Issue #{}", index)),
type_: None,
description: Some(desc),
url: None,
@@ -141,18 +148,23 @@ pub fn gitea_issue(interaction: &Interaction) -> InteractionResponse {
provider: None,
author: Some(EmbedAuthor {
name: Some(resp.title.clone()),
url: Some(format!("https://git.exmods.org/{}/{}/issues/{}", &username, &repo_name, index)),
url: Some(resp.html_url),
icon_url: None,
proxy_icon_url: None
}),
fields: None,
/*fields: Some(vec![
//fields: None,
fields: Some(vec![
EmbedField {
name: "Download".to_string(),
value: asset_str,
name: "Labels".to_string(),
value: tag_str,
inline: Some(true)
}
])*/
},
EmbedField {
name: "Repository".to_string(),
value: format!("[{}](https://git.exmods.org/{}/{})", resp.repository.name, &username, &repo_name),
inline: Some(true)
},
])
};
return InteractionResponse::ChannelMessageWithSource {
data: Some(InteractionApplicationCommandCallbackData {


Завантаження…
Відмінити
Зберегти