编辑带有图像附件的嵌入消息在chat-discord jda中加倍

pbpqsu0x  于 2021-07-03  发布在  Java
关注(0)|答案(0)|浏览(321)

我正在尝试用另一个嵌入来编辑邮件的嵌入。当我这样做时,图像会再次出现在聊天中编辑的嵌入的顶部。有没有办法防止这种情况?

@Override
    public void onGuildReady(@NotNull GuildReadyEvent event) {
        super.onGuildReady(event);

        String fileName = "image.png";

        Guild guild = event.getGuild();
        InputStream in = getClass().getResourceAsStream("/someResource.png");

        EmbedBuilder eb = new EmbedBuilder()
        .setTitle("Title :")
        .setDescription("Description")
        .setImage("attachment://" + fileName)
        .setColor(new Color(255, 204, 81));
        guild.getTextChannels().get(0).sendMessage(eb.build()).addFile(in, fileName).queue(
                message -> {
                    MessageEmbed me = message.getEmbeds().get(0);
                    message.editMessage(
                            new EmbedBuilder()
                            .setTitle(me.getTitle())
                            .setDescription(me.getDescription())
                            .setImage(me.getImage().getUrl())
                            .setColor(me.getColor())
                            .build()
                    ).queue();
                }
        );
    }

结果:

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题