@@ -226,7 +226,17 @@ public TicketCategory getCategory(String id) {
226226 if (id == null ) {
227227 return null ;
228228 }
229- return getCategories ().get (id );
229+ Map <String , TicketCategory > cats = getCategories ();
230+ TicketCategory direct = cats .get (id );
231+ if (direct != null ) {
232+ return direct ;
233+ }
234+ for (TicketCategory category : cats .values ()) {
235+ if (id .equals (category .label ) || id .equals (displayLabel (category ))) {
236+ return category ;
237+ }
238+ }
239+ return null ;
230240 }
231241
232242 public String defaultCategoryId () {
@@ -421,12 +431,11 @@ public void postPanel(TextChannel channel) {
421431 .setMinValues (1 )
422432 .setMaxValues (1 );
423433 for (TicketCategory c : cats .values ()) {
424- String label = c .emoji .isEmpty () ? c .label
425- : (c .emoji + " " + c .label );
434+ String label = displayLabel (c );
426435 String desc = c .description != null && c .description .length () > 100
427436 ? c .description .substring (0 , 97 ) + "..."
428437 : (c .description == null ? "" : c .description );
429- menu .addOption (c .id , label , desc );
438+ menu .addOption (label , c .id , desc );
430439 }
431440
432441 List <net .dv8tion .jda .api .interactions .components .LayoutComponent > rows = new ArrayList <>();
@@ -495,4 +504,10 @@ public List<UUID> getOpenTicketCreators() {
495504 public static boolean isUsableSnowflake (String value ) {
496505 return value != null && value .matches (SNOWFLAKE_PATTERN );
497506 }
507+
508+ private static String displayLabel (TicketCategory category ) {
509+ return category .emoji .isEmpty ()
510+ ? category .label
511+ : category .emoji + " " + category .label ;
512+ }
498513}
0 commit comments