当前位置: 首页>>代码示例>>Java>>正文


Java MessageEmbed.Field方法代码示例

本文整理汇总了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();
}
 
开发者ID:NucleusPowered,项目名称:Phonon,代码行数:11,代码来源:DiscordBot.java

示例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);
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:15,代码来源:ServerInfoCommand.java

示例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);
}
 
开发者ID:NucleusPowered,项目名称:Phonon,代码行数:4,代码来源:DiscordBot.java

示例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();
}
 
开发者ID:NucleusPowered,项目名称:Phonon,代码行数:7,代码来源:DiscordBot.java

示例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();
}
 
开发者ID:NucleusPowered,项目名称:Phonon,代码行数:7,代码来源:DiscordBot.java

示例6: addField

import net.dv8tion.jda.core.entities.MessageEmbed; //导入方法依赖的package包/类
public PlaceholderMessage addField(MessageEmbed.Field field) {
    builder.addField(field);
    return this;
}
 
开发者ID:avaire,项目名称:avaire,代码行数:5,代码来源:PlaceholderMessage.java

示例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);
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:6,代码来源:InfoCommand.java

示例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);
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:5,代码来源:ServerInfoCommand.java

示例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);
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:5,代码来源:ServerInfoCommand.java

示例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);
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:5,代码来源:ServerInfoCommand.java

示例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);
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:6,代码来源:ServerInfoCommand.java

示例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);
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:63,代码来源:ServerInfoCommand.java


注:本文中的net.dv8tion.jda.core.entities.MessageEmbed.Field方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。