From 70c772615a40d6cfb9f8c64976dd6ddf68bdedaa Mon Sep 17 00:00:00 2001 From: Tropical <42101043+Tropix126@users.noreply.github.com> Date: Tue, 26 Dec 2023 09:59:29 -0600 Subject: [PATCH] fallback to display event sku if program code is invalid --- src/commands/team.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/commands/team.rs b/src/commands/team.rs index 5e323d4..94c1237 100644 --- a/src/commands/team.rs +++ b/src/commands/team.rs @@ -489,11 +489,15 @@ impl TeamCommand { for event in events.data { embed = embed.field( event.name, - format!( - "[View More](https://robotevents.com/robot-competitions/{}/{})", - event.program.code.unwrap_or("UNKNOWN".to_string()), + if let Some(code) = event.program.code { + format!( + "[View More](https://robotevents.com/robot-competitions/{}/{})", + code, + event.sku + ) + } else { event.sku - ), + }, true ); }