java 如何在Discord JDA嵌入消息中使用本地文件作为缩略图?

new9mtju  于 2023-06-28  发布在  Java
关注(0)|答案(2)|浏览(101)

我想将嵌入的缩略图设置为我的电脑上的本Map像。
这可能吗?

EmbedBuilder builder = new EmbedBuilder();
builder.setThumbnail("1.png"); //relative path
0lvr5msh

0lvr5msh1#

您的问题类似于this question(您显然使用了embed.setThumbnail而不是embed.setImage)

jvidinwx

jvidinwx2#

* Sets the Thumbnail of the embed.
 * MessageChannel channel; // = reference of a MessageChannel
 * EmbedBuilder embed = new EmbedBuilder();
 * InputStream file = new URL("https://http.cat/500").openStream();
 * embed.setThumbnail("attachment://cat.png") // we specify this in sendFile as "cat.png"
 *      .setDescription("This is a cute cat :3");
 * channel.sendFiles(FileUpload.fromData(file, "cat.png")).setEmbeds(embed.build()).queue();

相关问题