本文整理汇总了Java中net.dv8tion.jda.core.entities.MessageEmbed.Field方法的典型用法代码示例。如果您正苦于以下问题:Java MessageEmbed.Field方法的具体用法?Java MessageEmbed.Field怎么用?Java MessageEmbed.Field使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.dv8tion.jda.core.entities.MessageEmbed
的用法示例。
在下文中一共展示了MessageEmbed.Field方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEmbed
import net.dv8tion.jda.core.entities.MessageEmbed; //导入方法依赖的package包/类
public MessageEmbed getEmbed(Color color, String title, String url, CharSequence description, MessageEmbed.Field... fields) {
EmbedBuilder e = new EmbedBuilder();
e.setColor(color);
for (MessageEmbed.Field field : fields) {
e.addField(field);
}
e.setTitle(title, url);
e.setDescription(description);
return e.build();
}
示例2: getChannelListField
import net.dv8tion.jda.core.entities.MessageEmbed; //导入方法依赖的package包/类
private MessageEmbed.Field getChannelListField(Guild guild) {
long total = guild.getTextChannels().size() + guild.getVoiceChannels().size();
StringBuilder memberBuilder = new StringBuilder();
if (!guild.getTextChannels().isEmpty()) {
memberBuilder.append(messageService.getMessage("discord.command.server.channels.text",
guild.getTextChannels().size())).append("\n");
}
if (!guild.getVoiceChannels().isEmpty()) {
memberBuilder.append(messageService.getMessage("discord.command.server.channels.voice",
guild.getVoiceChannels().size())).append("\n");
}
return new MessageEmbed.Field(messageService.getMessage("discord.command.server.channels", total),
memberBuilder.toString(), true);
}
示例3: getEmbedField
import net.dv8tion.jda.core.entities.MessageEmbed; //导入方法依赖的package包/类
public MessageEmbed.Field getEmbedField(String title, String description, boolean inline) {
return new MessageEmbed.Field(title, description, inline);
}
示例4: getEmbedWithThumbnail
import net.dv8tion.jda.core.entities.MessageEmbed; //导入方法依赖的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();
}
示例5: getEmbedWithThumbnailAndFooter
import net.dv8tion.jda.core.entities.MessageEmbed; //导入方法依赖的package包/类
public MessageEmbed getEmbedWithThumbnailAndFooter(Color color, String title, String url, CharSequence description, String thumbnailUrl, String footerUrl, String footerText, MessageEmbed.Field... fields) {
MessageEmbed e = getEmbedWithThumbnail(color, title, url, description, thumbnailUrl, fields);
EmbedBuilder ee = new EmbedBuilder(e);
ee.setFooter(footerText, footerUrl);
return ee.build();
}
示例6: addField
import net.dv8tion.jda.core.entities.MessageEmbed; //导入方法依赖的package包/类
public PlaceholderMessage addField(MessageEmbed.Field field) {
builder.addField(field);
return this;
}
示例7: getDateField
import net.dv8tion.jda.core.entities.MessageEmbed; //导入方法依赖的package包/类
protected MessageEmbed.Field getDateField(long epochSecond, String nameKey, DateTimeFormatter formatter) {
DateTime dateTime = new DateTime(epochSecond * 1000).withZone(DateTimeZone.UTC);
return new MessageEmbed.Field(messageService.getMessage(nameKey),
String.format("**%s**", formatter.print(dateTime)), true);
}
示例8: getVerificationLevel
import net.dv8tion.jda.core.entities.MessageEmbed; //导入方法依赖的package包/类
private MessageEmbed.Field getVerificationLevel(Guild guild) {
return new MessageEmbed.Field(messageService.getMessage("discord.command.server.verificationLevel"),
messageService.getEnumTitle(guild.getVerificationLevel()), true);
}
示例9: getOwner
import net.dv8tion.jda.core.entities.MessageEmbed; //导入方法依赖的package包/类
private MessageEmbed.Field getOwner(Guild guild) {
return new MessageEmbed.Field(messageService.getMessage("discord.command.server.owner"),
CommonUtils.formatUser(guild.getOwner().getUser()), true);
}
示例10: getRegion
import net.dv8tion.jda.core.entities.MessageEmbed; //导入方法依赖的package包/类
private MessageEmbed.Field getRegion(Guild guild) {
return new MessageEmbed.Field(messageService.getMessage("discord.command.server.region"),
messageService.getEnumTitle(guild.getRegion()), true);
}
示例11: getCreatedAt
import net.dv8tion.jda.core.entities.MessageEmbed; //导入方法依赖的package包/类
private MessageEmbed.Field getCreatedAt(Guild guild) {
DateTimeFormatter formatter = DateTimeFormat.fullDateTime().withLocale(contextService.getLocale());
return getDateField(guild.getCreationTime().toEpochSecond(), "discord.command.server.createdAt",
formatter);
}
示例12: getMemberListField
import net.dv8tion.jda.core.entities.MessageEmbed; //导入方法依赖的package包/类
private MessageEmbed.Field getMemberListField(Guild guild) {
List<Member> memberList = guild.getMembers();
class Info {
long userCount = 0;
long botCount = 0;
long online = 0;
long offline = 0;
long dnd = 0;
long idle = 0;
}
Info memberInfo = new Info();
guild.getMembers().forEach(member -> {
User user = member.getUser();
if (user.isBot()) {
memberInfo.botCount++;
} else {
memberInfo.userCount++;
}
switch (member.getOnlineStatus()) {
case ONLINE:
memberInfo.online++;
break;
case OFFLINE:
case INVISIBLE:
memberInfo.offline++;
break;
case IDLE:
memberInfo.idle++;
break;
case DO_NOT_DISTURB:
memberInfo.dnd++;
break;
}
});
StringBuilder memberBuilder = new StringBuilder();
if (memberInfo.userCount > 0) {
memberBuilder.append(messageService.getMessage("discord.command.server.members.users", memberInfo.userCount))
.append("\n");
}
if (memberInfo.botCount > 0) {
memberBuilder.append(messageService.getMessage("discord.command.server.members.bots", memberInfo.botCount))
.append("\n");
}
if (memberInfo.online > 0) {
memberBuilder.append(messageService.getMessage("discord.command.server.members.status.online", memberInfo.online))
.append("\n");
}
if (memberInfo.idle > 0) {
memberBuilder.append(messageService.getMessage("discord.command.server.members.status.idle", memberInfo.idle))
.append("\n");
}
if (memberInfo.dnd > 0) {
memberBuilder.append(messageService.getMessage("discord.command.server.members.status.dnd", memberInfo.dnd))
.append("\n");
}
if (memberInfo.offline > 0) {
memberBuilder.append(messageService.getMessage("discord.command.server.members.status.offline", memberInfo.offline))
.append("\n");
}
return new MessageEmbed.Field(messageService.getMessage("discord.command.server.members", memberList.size()),
memberBuilder.toString(), true);
}