Skip to content

Content may not be blank error in ComponentsV2Example #3032

@brentspine

Description

@brentspine

General Troubleshooting

  • I have checked for similar issues on the Issue-tracker.
  • I have checked for PRs that might already address this issue.

Version of JDA

6.3.0

Expected Behaviour

Copy the example ComponentsV2Example and try to run it

Code Example for Reproduction Steps

private void onComponentsV2Butterfly(@Nonnull SlashCommandInteractionEvent event) {
        Container container = Container.of(
                TextDisplay.of("Summary of Daylight Prairie"),
                TextDisplay.of(
                        "### [Butterfly Fields](https://sky-children-of-the-light.fandom.com/wiki/Daylight_Prairie#Butterfly_Fields)"),
                Separator.createDivider(Separator.Spacing.LARGE),
                Section.of(
                        Thumbnail.fromFile(getResourceAsFileUpload("/Prairie_ButterflyFields.jpg"))
                                // Set an "alternative text", useful for accessibility
                                .withDescription("Butterfly Fields"),
                        TextDisplay.of("""
                                        The Butterfly Fields is a prairie field covered in bountiful fauna. In the fields, players once again find Butterflies that can help reach otherwise difficult to access places. The field contains gateways into three of Prairie's main locations: Prairie Village, Bird Nest - with a Spirit Gate requiring 4 Prairie Regular Spirits relived - and the Prairie Caves - with a Spirit Gate requiring 2 Isle Regular Spirits and 3 Prairie Regular Spirits relived. A Passage Mask can be found to the left side, near the cave with Prairie Child of Light #1, to light and do Passage Quest #4. For a new player, Village is the only available path.

                                        *Source: [Daylight_Prairie#Butterfly_Fields](https://sky-children-of-the-light.fandom.com/wiki/Daylight_Prairie#Butterfly_Fields)*
                                        -# Page 2/9
                                        """)),
                TextDisplay.of(""),
                Separator.createDivider(Separator.Spacing.SMALL),
                ActionRow.of(
                        Button.secondary("previous", "⬅ Social Space"),
                        Button.success("back", "Back").withEmoji(backEmoji),
                        Button.secondary("next", "Prairie Village ➡")),
                Separator.createDivider(Separator.Spacing.SMALL),
                ActionRow.of(StringSelectMenu.create("area")
                        .addOption("Social Space", "social_space")
                        .addOption("Butterfly Fields", "butterfly_fields")
                        .addOption("Prairie Village", "prairie_village")
                        .setDefaultValues("butterfly_fields")
                        .build()));

        // No need to upload files here, it's taken care of automatically
        event.replyComponents(container)
                // This is required any time you are using Components V2
                .useComponentsV2()
                .setEphemeral(true)
                .queue();
    }

Code for JDABuilder or DefaultShardManagerBuilder used

@Bean
    public JDA jda() throws InterruptedException {
        String token = loadToken();
        if (token == null) {
            throw new IllegalStateException("DISCORD_BOT_TOKEN is not configured");
        }

        JDA jda = JDABuilder.create(token,
                        List.of(
                                GatewayIntent.MESSAGE_CONTENT,
                                GatewayIntent.GUILD_MEMBERS,
                                GatewayIntent.GUILD_MESSAGES,
                                GatewayIntent.GUILD_PRESENCES
                        )
                )
                .disableCache(
                        CacheFlag.ACTIVITY,
                        CacheFlag.VOICE_STATE,
                        CacheFlag.STICKER,
                        CacheFlag.CLIENT_STATUS,
                        CacheFlag.ONLINE_STATUS,
                        CacheFlag.SCHEDULED_EVENTS
                )
                .setActivity(Activity.of(Activity.ActivityType.PLAYING, "[...]"))
                .setChunkingFilter(ChunkingFilter.ALL)
                .setMemberCachePolicy(MemberCachePolicy.ALL)
                .setStatus(OnlineStatus.ONLINE)
                .build();

        jda.awaitReady();
        return jda;
    }

Exception or Error

java.lang.IllegalArgumentException: Content may not be blank
	at net.dv8tion.jda.internal.utils.Checks.notBlank(Checks.java:101) ~[JDA-6.3.0.jar:6.3.0]
	at net.dv8tion.jda.api.components.textdisplay.TextDisplay.of(TextDisplay.java:60) ~[JDA-6.3.0.jar:6.3.0]
	at net.msnap.discordservice.commands.example.ComponentsV2Example.onComponentsV2Butterfly(ComponentsV2Example.java:135) ~[classes/:na]
	at net.msnap.discordservice.commands.example.ComponentsV2Example.onSlashCommandInteraction(ComponentsV2Example.java:53) ~[classes/:na]
	at net.dv8tion.jda.api.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:660) ~[JDA-6.3.0.jar:6.3.0]
	at net.dv8tion.jda.api.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:89) ~[JDA-6.3.0.jar:6.3.0]
	at net.dv8tion.jda.internal.hooks.EventManagerProxy.handleInternally(EventManagerProxy.java:76) ~[JDA-6.3.0.jar:6.3.0]
	at net.dv8tion.jda.internal.hooks.EventManagerProxy.handle(EventManagerProxy.java:63) ~[JDA-6.3.0.jar:6.3.0]
	at net.dv8tion.jda.internal.JDAImpl.handleEvent(JDAImpl.java:182) ~[JDA-6.3.0.jar:6.3.0]
	at net.dv8tion.jda.internal.handle.InteractionCreateHandler.handleCommand(InteractionCreateHandler.java:100) ~[JDA-6.3.0.jar:6.3.0]
	at net.dv8tion.jda.internal.handle.InteractionCreateHandler.handleInternally(InteractionCreateHandler.java:77) ~[JDA-6.3.0.jar:6.3.0]
	at net.dv8tion.jda.internal.handle.SocketHandler.handle(SocketHandler.java:39) ~[JDA-6.3.0.jar:6.3.0]
	at net.dv8tion.jda.internal.requests.WebSocketClient.onDispatch(WebSocketClient.java:936) ~[JDA-6.3.0.jar:6.3.0]
	at net.dv8tion.jda.internal.requests.WebSocketClient.onEvent(WebSocketClient.java:826) ~[JDA-6.3.0.jar:6.3.0]
	at net.dv8tion.jda.internal.requests.WebSocketClient.handleEvent(WebSocketClient.java:809) ~[JDA-6.3.0.jar:6.3.0]
	at net.dv8tion.jda.internal.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:980) ~[JDA-6.3.0.jar:6.3.0]
	at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:385) ~[nv-websocket-client-2.14.jar:na]
	at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:276) ~[nv-websocket-client-2.14.jar:na]
	at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:996) ~[nv-websocket-client-2.14.jar:na]
	at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:755) ~[nv-websocket-client-2.14.jar:na]
	at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108) ~[nv-websocket-client-2.14.jar:na]
	at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64) ~[nv-websocket-client-2.14.jar:na]
	at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45) ~[nv-websocket-client-2.14.jar:na]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions