fix: handle blank Explanation
All checks were successful
Build and Test / splatie (push) Successful in 10m10s
All checks were successful
Build and Test / splatie (push) Successful in 10m10s
This commit is contained in:
parent
189a36989d
commit
1b6edcced4
1 changed files with 18 additions and 17 deletions
|
|
@ -74,34 +74,35 @@ fn create_error_explain_message(str_code: &str, expanded: bool) -> Option<EditMe
|
|||
let mut embed = CreateEmbed::new()
|
||||
.title(str_code);
|
||||
|
||||
if expanded{
|
||||
embed = embed.field("Module", category_info.name, true)
|
||||
if expanded {
|
||||
embed = embed
|
||||
.field("Module", category_info.name, true)
|
||||
.field("System", category_info.system, true)
|
||||
.field("Module Description", category_info.description, true)
|
||||
.field("Name", error_info.name, false)
|
||||
.field("Explanation", format!("```{}```", error_info.message), true)
|
||||
.field("Name", error_info.name, false);
|
||||
|
||||
if !error_info.message.trim().is_empty() {
|
||||
embed = embed.field("Explanation", format!("```{}```", error_info.message), true);
|
||||
}
|
||||
|
||||
embed = embed
|
||||
.field("Description", error_info.long_description, true)
|
||||
.field("Solution", error_info.long_solution, true)
|
||||
;
|
||||
.field("Solution", error_info.long_solution, true);
|
||||
} else {
|
||||
embed = embed.field("Name", error_info.name, true)
|
||||
embed = embed
|
||||
.field("Name", error_info.name, true)
|
||||
.field("Description", error_info.short_description, true)
|
||||
.field("Solution", error_info.short_solution, true)
|
||||
.field("Solution", error_info.short_solution, true);
|
||||
}
|
||||
|
||||
let expand_button =
|
||||
CreateButton::new(format!("ERROR_EXPLAIN:{}", str_code))
|
||||
.label("Expand")
|
||||
.disabled(expanded);
|
||||
let expand_button = CreateButton::new(format!("ERROR_EXPLAIN:{}", str_code))
|
||||
.label("Expand")
|
||||
.disabled(expanded);
|
||||
|
||||
let message = EditMessage::new()
|
||||
.embed(embed)
|
||||
.components(vec![
|
||||
Buttons(
|
||||
vec![
|
||||
expand_button
|
||||
]
|
||||
)
|
||||
CreateActionRow::Buttons(vec![expand_button])
|
||||
])
|
||||
.content("");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue