本文整理汇总了Java中net.dv8tion.jda.core.EmbedBuilder.setThumbnail方法的典型用法代码示例。如果您正苦于以下问题:Java EmbedBuilder.setThumbnail方法的具体用法?Java EmbedBuilder.setThumbnail怎么用?Java EmbedBuilder.setThumbnail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.dv8tion.jda.core.EmbedBuilder
的用法示例。
在下文中一共展示了EmbedBuilder.setThumbnail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doCommand
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
protected void doCommand(CommandEvent e) {
EmbedBuilder eb = new EmbedBuilder();
JDA jda = getMcb().getBot().getJda();
Color color = Bot.BOT_COLOR; //e.getGuild().getMember(jda.getSelfUser()).getColor()
eb.setColor(color);
eb.setDescription(Locale.getCommandsMessage("help.more").f(e.getClient().getPrefix()));
if (e.getArgs().isEmpty()) {
eb.setAuthor("Minecordbot Commands", null, null);
eb.setThumbnail("https://vectr.com/cyrien/k3vhJlcOMS.png?width=168&height=168&select=k3vhJlcOMSpage0");
eb = listCommands(eb);
User user = jda.getUserById("193970511615623168");
if (user != null) {
eb.setFooter("Questions? contact " + user.getName() + "#" + user.getDiscriminator() + " or join https://discord.cyrien.us", user.getAvatarUrl());
respond(e, eb.build());
}
}
}
示例2: doCommand
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public boolean doCommand(MessageReceivedEvent message, BotContext context, String query) {
Guild guild = message.getGuild();
EmbedBuilder builder = messageService.getBaseEmbed();
builder.setTitle(messageService.getMessage("discord.command.server.title", guild.getName()));
builder.setThumbnail(guild.getIconUrl());
builder.setFooter(messageService.getMessage("discord.command.info.identifier", guild.getId()), null);
builder.addField(getMemberListField(guild));
builder.addField(getChannelListField(guild));
builder.addField(getVerificationLevel(guild));
builder.addField(getRegion(guild));
builder.addField(getOwner(guild));
builder.addField(getCreatedAt(guild));
messageService.sendMessageSilent(message.getChannel()::sendMessage, builder.build());
return true;
}
示例3: execute
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
protected Message execute(CommandManager.ParsedCommandInvocation parsedCommandInvocation, UserPermissions userPermissions) {
Message message = parsedCommandInvocation.getMessage();
Guild guild = message.getGuild();
TextChannel channel = message.getTextChannel();
StringBuilder rawRoles = new StringBuilder();
guild.getRoles().forEach(r -> rawRoles.append(r.getName()).append(", "));
StringBuilder roles = new StringBuilder(rawRoles.toString());
roles.replace(rawRoles.lastIndexOf(","), roles.lastIndexOf(",") + 1, "" );
EmbedBuilder serverInfo = new EmbedBuilder();
serverInfo.setColor(Colors.COLOR_PRIMARY);
serverInfo.setTitle(":desktop: Serverinfo of " + guild.getName());
serverInfo.setThumbnail(guild.getIconUrl());
serverInfo.addField("ID", "`" + guild.getId() + "`", false);
serverInfo.addField("Guildname", "`" + guild.getName() + "`", false);
serverInfo.addField("Server region", guild.getRegion().toString(), false);
serverInfo.addField("Members", String.valueOf(guild.getMembers().size()), false);
serverInfo.addField("Textchannels", String.valueOf(guild.getTextChannels().size()), false);
serverInfo.addField("Voicechannels", String.valueOf(guild.getVoiceChannels().size()), false);
serverInfo.addField("Roles", String.valueOf(guild.getRoles().size()) + "\n ```" + roles.toString() + "```", false);
serverInfo.addField("Server owner", guild.getOwner().getUser().getName() + "#" + guild.getOwner().getUser().getDiscriminator(), false);
serverInfo.addField("Server icon url", guild.getIconUrl(), false);
serverInfo.addField("Server Creation Date", guild.getCreationTime().format(DateTimeFormatter.ISO_DATE_TIME), false);
return new MessageBuilder().setEmbed(serverInfo.build()).build();
}
示例4: action
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public void action(String[] args, MessageReceivedEvent event) {
String query = new String();
for (String arg : args) {
query += arg + " ";
}
EmbedBuilder builder = new EmbedBuilder();
builder.setColor(Color.decode(SelfBot.getConfig().getColor()));
builder.setAuthor(event.getAuthor().getName() + "#" + event.getAuthor().getDiscriminator() + " created a poll", null, event.getAuthor().getAvatarUrl());
builder.setThumbnail("http://i.imgur.com/pwVKRqD.png");
builder.addField(":grey_question: Question :", query, false);
event.getMessage().editMessage(builder.build()).queue();
event.getMessage().addReaction("\uD83D\uDC4D").queue();
event.getMessage().addReaction("\ud83d\udc4e").queue();
event.getMessage().addReaction("\uD83E\uDD37").queue();
}
示例5: createMythicEmbed
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
/**
* Create an embed of a Mythic week
* @param weekAffixes The affixes to add to the embed.
* @return A {@link EmbedBuilder} to send to the user.
*/
public static EmbedBuilder createMythicEmbed(LegendaryBot bot, Guild guild, String[] weekAffixes) {
EmbedBuilder eb = new EmbedBuilder();
eb.setThumbnail("http://wow.zamimg.com/images/wow/icons/large/inv_relics_hourglass.jpg");
eb.setFooter(bot.getTranslateManager().translate(guild,"mythicplus.affixes"), "http://wow.zamimg.com/images/wow/icons/large/inv_relics_hourglass.jpg");
AffixDescription affix4 = Utils.affixDescription.get(weekAffixes[0]);
AffixDescription affix7 = Utils.affixDescription.get(weekAffixes[1]);
AffixDescription affix10 = Utils.affixDescription.get(weekAffixes[2]);
int difficulty = affix4.getDifficulty() + affix7.getDifficulty() + affix10.getDifficulty();
if (difficulty <= 3) {
eb.setColor(Color.GREEN);
} else if (difficulty == 4) {
eb.setColor(Color.YELLOW);
} else {
eb.setColor(Color.RED);
}
//TODO link the proper language wowhead site for the language of the guild
eb.addField("(4) " + bot.getTranslateManager().translate(guild,"affix."+weekAffixes[0].toLowerCase()+".name"),bot.getTranslateManager().translate(guild, "affix."+weekAffixes[0].toLowerCase() + ".description") + "\n[" + bot.getTranslateManager().translate(guild, "more.info")+"](http://www.wowhead.com/affix="+affix4.getId()+")",false);
eb.addField("(7) " +bot.getTranslateManager().translate(guild,"affix."+weekAffixes[1].toLowerCase()+".name"),bot.getTranslateManager().translate(guild, "affix."+weekAffixes[1].toLowerCase() + ".description") + "\n[" + bot.getTranslateManager().translate(guild, "more.info")+"](http://www.wowhead.com/affix="+affix7.getId()+")",false);
eb.addField("(10) " + bot.getTranslateManager().translate(guild,"affix."+weekAffixes[2].toLowerCase()+".name"),bot.getTranslateManager().translate(guild, "affix."+weekAffixes[2].toLowerCase() + ".description") + "\n[" + bot.getTranslateManager().translate(guild, "more.info")+"](http://www.wowhead.com/affix="+affix10.getId()+")",false);
return eb;
}
示例6: action
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public void action(String[] args, MessageReceivedEvent event) {
EmbedBuilder builder = new EmbedBuilder();
builder.setAuthor("Server Info", null, "http://i.imgur.com/880AyL6.png");
builder.setColor(Color.decode(SelfBot.getConfig().getColor()));
builder.setThumbnail(event.getGuild().getIconUrl());
builder.addField("Name", event.getGuild().getName(), true);
builder.addBlankField(true);
builder.addField("Owner", event.getGuild().getOwner().getUser().getName() + "#" + event.getGuild().getOwner().getUser().getDiscriminator() , true);
builder.addField("Server ID", event.getGuild().getId(), true);
builder.addField("Region", event.getGuild().getRegion().name(), true);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy h:mm a");
builder.addField("Creation Date", event.getGuild().getCreationTime().format(formatter), true);
builder.addField("Total Members", String.valueOf(event.getGuild().getMembers().size()), true);
int online = 0;
for(Member member : event.getGuild().getMembers()) {
if(!member.getOnlineStatus().equals(OnlineStatus.OFFLINE)) {
++online;
}
}
builder.addField("Online Members", String.valueOf(online), true);
event.getMessage().editMessage(builder.build()).queue();
}
示例7: addHeroProtraits
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
private void addHeroProtraits(OWHerosPayload payload, EmbedBuilder builder) {
RegionHeros region = payload.getFirstValidRegion();
if (region != null && region.getHeros() != null && region.getHeros().getPlaytime() != null) {
Map<String, Float> heroMap = region.getHeros().getPlaytime().getFirstUsableMap();
if (!heroMap.isEmpty()) {
String hero = getTopHeroFromMap(heroMap.entrySet());
builder.setThumbnail(getHeroPortait(hero));
}
}
}
示例8: action
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public void action(String[] args, MessageReceivedEvent event) {
EmbedBuilder builder = new EmbedBuilder();
builder.setAuthor("Information about " + event.getAuthor().getName() + "#" + event.getAuthor().getDiscriminator(), null, "http://i.imgur.com/880AyL6.png");
builder.setColor(Color.decode(SelfBot.getConfig().getColor()));
builder.setThumbnail(event.getAuthor().getAvatarUrl());
builder.setTitle(SelfBot.getConfig().getTitle(), null);
builder.setDescription(SelfBot.getConfig().getDescription());
builder.addField(SelfBot.getConfig().getMainTextTitle(), SelfBot.getConfig().getMainText(), false);
builder.setFooter(SelfBot.getConfig().getFooter(), null);
event.getMessage().editMessage(builder.build()).queue();
}
示例9: sendNowPlaying
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
public void sendNowPlaying() {
isPlaying = true;
currentTrack = musicManager.player.getPlayingTrack();
String title = currentTrack.getInfo().title;
String position = getTimestamp(currentTrack.getPosition());
String duration = getTimestamp(currentTrack.getDuration());
String msg = String.format("[%s](%s)\n\n**Time:** \n[%s / %s]", title, currentTrack.getInfo().uri, position, duration);
EmbedBuilder builder = new EmbedBuilder();
builder.setColor(server.getSelfMember().getColor());
builder.setTitle("Playing:");
builder.setDescription(msg);
if (currentTrack instanceof YoutubeAudioTrack) {
String id = YouTubeHelper.extractVideoIdFromUrl(currentTrack.getInfo().uri);
trackImgUrl = String.format(Constant.youtubeThumbnailUrl, id);
} else if (currentTrack instanceof VimeoAudioTrack) {
trackImgUrl = Constant.vimeoIconUrl;
} else if (currentTrack instanceof TwitchStreamAudioTrack) {
trackImgUrl = Constant.twitchIconUrl;
} else if (currentTrack instanceof SoundCloudAudioTrack) {
trackImgUrl = Constant.soundcloudIconUrl;
} else if (currentTrack instanceof BandcampAudioTrack) {
trackImgUrl = Constant.bandcampIconUrl;
} else {
trackImgUrl = Constant.lambdaMusicIconUrl;
}
builder.setThumbnail(trackImgUrl);
builder.setFooter(server.getSelfMember().getNickname() != null ? server.getSelfMember().getNickname() : server.getSelfMember().getEffectiveName(), server.getIconUrl());
channel.getManager().setTopic("**Playing:** " + title).queue();
Message theMessage = channel.sendMessage(builder.build()).complete();
idMessageNowPlaying = theMessage.getId();
try {
channel.addReactionById(idMessageNowPlaying, "⏹").complete(true);
channel.addReactionById(idMessageNowPlaying, "⏯").complete(true);
channel.addReactionById(idMessageNowPlaying, "⏭").submit();
} catch (Exception e) {
}
}
示例10: sendNowPaused
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
public void sendNowPaused() {
isPlaying = false;
channel.getManager().setTopic("").queue();
channel.deleteMessageById(idMessageNowPlaying).complete();
idMessageNowPlaying = "";
currentTrack = musicManager.player.getPlayingTrack();
String title = currentTrack.getInfo().title;
String position = getTimestamp(currentTrack.getPosition());
String duration = getTimestamp(currentTrack.getDuration());
String msg = String.format("[%s](%s)\n\n**Time:** \n[%s / %s]", title, currentTrack.getInfo().uri, position, duration);
EmbedBuilder builder = new EmbedBuilder();
builder.setColor(server.getSelfMember().getColor());
builder.setTitle("Paused:");
builder.setDescription(msg);
builder.setThumbnail(trackImgUrl);
builder.setFooter(server.getSelfMember().getNickname() != null ? server.getSelfMember().getNickname() : server.getSelfMember().getEffectiveName(), server.getIconUrl());
channel.getManager().setTopic("**Paused:** " + title).queue();
Message theMessage = channel.sendMessage(builder.build()).complete();
idMessageNowPlaying = theMessage.getId();
try {
channel.addReactionById(idMessageNowPlaying, "⏹").complete(true);
channel.addReactionById(idMessageNowPlaying, "⏯").complete(true);
channel.addReactionById(idMessageNowPlaying, "⏭").submit();
} catch (Exception e) {
}
}
示例11: run
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
public Result run(String[] argsOrig, MessageReceivedEvent e) {
//Check for proper argument length
if (argsOrig.length < 2) {
return new Result(Outcome.WARNING, ":warning: Please specify a message.");
}
//Extract channel
String[] args = ArrayUtils.remove(MessageUtils.getContent(e.getMessage(), true), 0);
TextChannel channel = null;
if (args[0].matches(MessageUtils.channelRegex)) {
channel = e.getMessage().getMentionedChannels().get(0);
} else if (args[0].matches(MessageUtils.idRegex)) {
channel = DiscordUtils.getTextChannelById(args[0]);
} else {
return new Result(Outcome.ERROR, ":x: Not a valid channel!");
}
//Send the message
String msg = String.join(" ", ArrayUtils.remove(args, 0));
channel.sendMessage(msg).queue();
//Log it
EmbedBuilder eb = new EmbedBuilder();
Guild guild = channel.getGuild();
eb.setAuthor(e.getAuthor().getName() + " (" + e.getAuthor().getId() + ")",
null, e.getAuthor().getAvatarUrl());
eb.setDescription("**Sent a msg to `" + channel.getName() + "` (" + channel.getId() + ")**\non `" +
guild.getName() + "` (" + guild.getId() + "):\n" + msg);
eb.setThumbnail(guild.getIconUrl());
MessageUtils.log(eb.build());
return new Result(Outcome.SUCCESS);
}
示例12: execute
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public void execute(MessageReceivedEvent event, String[] args) {
String streamersConfig = plugin.getBot().getGuildSettings(event.getGuild()).getSetting(StreamersPlugin.CONFIG_KEY);
if (streamersConfig != null) {
EmbedBuilder eb = new EmbedBuilder();
eb.setTitle("Server Streamers");
eb.setColor(new Color(100,65,164));
eb.setThumbnail("https://www-cdn.jtvnw.net/images/twitch_logo3.jpg");
Arrays.stream(streamersConfig.split(";")).forEach(s -> {
String[] streamer = s.split(",");
StreamPlatform platform = StreamPlatform.valueOf(streamer[1]);
Map<String, String> result = plugin.isStreaming(streamer[0], platform);
String output = "";
if (result.size() != 0) {
String url = "";
if (platform == StreamPlatform.TWITCH) {
url = "https://twitch.tv/" + streamer[0];
} else if (platform == StreamPlatform.MIXER) {
url = "https://mixer.com/" + streamer[0];
}
output = "[" + result.get(StreamersPlugin.STATUS_KEY) + " in " + result.get(StreamersPlugin.GAME_KEY) + "!](" + url + ")";
} else {
output = streamer[0] + " is not streaming!";
}
eb.addField(streamer[0],output, false);
});
event.getChannel().sendMessage(eb.build()).queue();
} else {
event.getChannel().sendMessage("No streamers on this server!").queue();
}
}
示例13: execute
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event)
{
Color color;
Config config = null;
if(event.isFromType(ChannelType.PRIVATE))
color = Color.decode("#33ff00");
else
color = event.getGuild().getSelfMember().getColor();
try
{
config = new Config();
}
catch(Exception e)
{
e.printStackTrace();
}
String title = ":information_source: Information about **"+event.getSelfUser().getName()+"**";
EmbedBuilder builder = new EmbedBuilder();
User owner = event.getJDA().getUserById(config.getOwnerId());
String ownername = owner.getName()+"#"+owner.getDiscriminator();
String ownerid = owner.getId();
builder.setDescription("Hi, I'm Endless! A multipurpose bot designed to be smart.\n"
+ "If you found a bug please contact my dad\n"
+ "("+Const.DEV+")!\n");
builder.addField(":bust_in_silhouette: Owner:", "**"+ownername+"** (**"+ownerid+"**)", false);
builder.addField("<:jda:325395909347115008> Library:", "Java Discord API (JDA) "+JDAInfo.VERSION+" and JDA Utilities "+JDAUtilitiesInfo.VERSION, false);
builder.addField("<:github:326118305062584321> GitHub:", "Did you found a bug? Want improve something?\n"
+ "Please open an Issue or create a PR on GitHub\n"
+ "**https://github.com/ArtutoGamer/Endless**\n", false);
builder.addField(":link: Support Guild:", "**[Support]("+Const.INVITE+")**\n", false);
builder.setFooter("Version: "+Const.VERSION+" | Latest Start", null);
builder.setColor(color);
builder.setTimestamp(event.getClient().getStartTime());
builder.setThumbnail(event.getSelfUser().getAvatarUrl());
event.getChannel().sendMessage(new MessageBuilder().append(title).setEmbed(builder.build()).build()).queue();
}
示例14: getEmbedWithThumbnail
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
public MessageEmbed getEmbedWithThumbnail(Color color, String title, String url, CharSequence description, String thumbnailUrl, MessageEmbed.Field... fields) {
MessageEmbed e = getEmbed(color, title, url, description, fields);
EmbedBuilder ee = new EmbedBuilder(e);
ee.setThumbnail(thumbnailUrl);
return ee.build();
}
示例15: action
import net.dv8tion.jda.core.EmbedBuilder; //导入方法依赖的package包/类
@Override
public void action(String[] args, MessageReceivedEvent event) {
if(event.getMessage().getMentionedUsers().isEmpty()) {
event.getMessage().editMessage("No user mentioned.");
return;
}
User user = event.getMessage().getMentionedUsers().get(0);
EmbedBuilder builder = new EmbedBuilder();
builder.setAuthor("Information about " + user.getName() + "#" + user.getDiscriminator() , null, "http://i.imgur.com/880AyL6.png");
builder.setColor(event.getGuild().getMemberById(user.getId()).getColor());
builder.setThumbnail(user.getAvatarUrl());
builder.addField(":id: User ID", user.getId(), true);
String nickname = "None";
if(event.getGuild().getMemberById(user.getId()).getNickname() != null) nickname = event.getGuild().getMemberById(user.getId()).getNickname();
builder.addField(":information_source: Nickname", nickname, true);
builder.addField(":computer: Status", event.getGuild().getMemberById(user.getId()).getOnlineStatus().name().toLowerCase(), true);
String activity = "None";
if(event.getGuild().getMemberById(user.getId()).getGame() != null) {
activity = event.getGuild().getMemberById(user.getId()).getGame().getName();
}
builder.addField(":video_game: Activity", activity, true);
String isOwner = "No";
if( event.getGuild().getMemberById(user.getId()).isOwner()) {
isOwner = "Yes";
}
builder.addField(":white_check_mark: Owner", isOwner, true);
String role = "No role";
if(!event.getGuild().getMemberById(user.getId()).getRoles().isEmpty()) {
role = event.getGuild().getMemberById(user.getId()).getRoles().get(0).getName();
}
builder.addField(":medal: Higher role", role, true);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy h:mm a");
builder.addField(":clock2: Creation date", user.getCreationTime().format(formatter), true);
builder.addField(":inbox_tray: Join date", event.getGuild().getMemberById(user.getId()).getJoinDate().format(formatter), true);
event.getMessage().editMessage(builder.build()).queue();
}