@@ -88,26 +88,28 @@ public void handleAutoComplete(CommandAutoCompleteInteractionEvent event, AutoCo
8888 public static void detachFromMessage (FormData form , Guild guild ) {
8989 if (!form .isAttached ()) return ;
9090 TextChannel formChannel = guild .getTextChannelById (form .getMessageChannel ().get ());
91- if (formChannel != null ) formChannel .retrieveMessageById (form .getMessageId ().get ()).queue (msg -> {
92- List <ActionRow > components = msg .getComponents ().stream ().map (msgComponent -> {
93- ActionRow row = msgComponent .asActionRow ();
94- List <ActionRowChildComponentUnion > cpts = row .getComponents ().stream ().filter (cpt -> {
95- if (cpt instanceof Button btn ) {
96- String cptId = btn .getCustomId ();
97- String [] split = ComponentIdBuilder .split (cptId );
98- if (split [0 ].equals (FormInteractionManager .FORM_COMPONENT_ID )) {
99- return !split [1 ].equals (Long .toString (form .id ()));
91+ if (formChannel != null ) {
92+ formChannel .retrieveMessageById (form .getMessageId ().get ()).queue (msg -> {
93+ List <ActionRow > components = msg .getComponents ().stream ().map (msgComponent -> {
94+ ActionRow row = msgComponent .asActionRow ();
95+ List <ActionRowChildComponentUnion > cpts = row .getComponents ().stream ().filter (cpt -> {
96+ if (cpt instanceof Button btn ) {
97+ String cptId = btn .getCustomId ();
98+ String [] split = ComponentIdBuilder .split (cptId );
99+ if (split [0 ].equals (FormInteractionManager .FORM_COMPONENT_ID )) {
100+ return !split [1 ].equals (Long .toString (form .id ()));
101+ }
100102 }
103+ return true ;
104+ }).toList ();
105+ if (cpts .isEmpty ()) {
106+ return null ;
101107 }
102- return true ;
103- }).toList ();
104- if (cpts .isEmpty ()) {
105- return null ;
106- }
107- return ActionRow .of (cpts );
108- }).filter (Objects ::nonNull ).toList ();
109- msg .editMessageComponents (components ).queue ();
110- }, e -> ExceptionLogger .capture (e ));
108+ return ActionRow .of (cpts );
109+ }).filter (Objects ::nonNull ).toList ();
110+ msg .editMessageComponents (components ).queue ();
111+ }, e -> ExceptionLogger .capture (e ));
112+ }
111113 }
112114
113115}
0 commit comments