當前位置: 首頁>>代碼示例>>Java>>正文


Java EmbedBuilder.addField方法代碼示例

本文整理匯總了Java中net.dv8tion.jda.core.EmbedBuilder.addField方法的典型用法代碼示例。如果您正苦於以下問題:Java EmbedBuilder.addField方法的具體用法?Java EmbedBuilder.addField怎麽用?Java EmbedBuilder.addField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.dv8tion.jda.core.EmbedBuilder的用法示例。


在下文中一共展示了EmbedBuilder.addField方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public void run() {
    Roles.TWITTER.getRole().getManager().setMentionable(true).queue();
    EmbedBuilder builder = new EmbedBuilder()
            .setThumbnail(status.getUser().getBiggerProfileImageURL())
            .setTitle("@" + status.getUser().getScreenName() + " has just tweeted", "https://twitter.com/" + status.getUser().getScreenName() + "/status/" + status.getId())
            .setDescription(status.getText())
            .setColor(new Color(0, 172, 237));
    if (status.getInReplyToScreenName() != null) {
        builder.addField("In reply to..", "[In reply to this @" + status.getInReplyToScreenName() + "'s tweet]" +
                "(https://twitter.com/" + status.getInReplyToScreenName() + "/status/" + status.getInReplyToStatusId() + ")", false);
    }
    if (status.getUser().getId() == twitterCentre.getHappyid()) {
        Channels.TWITTER.getChannel().sendMessage(Roles.TWITTER.getRole().getAsMention()).queue();
        Channels.TWITTER.getChannel().sendMessage(builder.build()).queue();
    }
    try {
        TimeUnit.SECONDS.sleep(1);
    } catch (InterruptedException e) {
        e.printStackTrace();
    } finally {
        Roles.TWITTER.getRole().getManager().setMentionable(false).queue();
    }
}
 
開發者ID:WheezyGold7931,項目名稱:happybot,代碼行數:25,代碼來源:TweetMonitor.java

示例2: fillEmbed

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
public static EmbedBuilder fillEmbed(Map<LoggedEvent, AtomicInteger> events, EmbedBuilder builder) {
	int total = events.values().stream().mapToInt(AtomicInteger::get).sum();

	if (total == 0) {
		builder.addField("Nothing Here.", "Just dust.", false);
		return builder;
	}

	events.entrySet().stream()
		.filter(entry -> entry.getValue().get() > 0)
		.sorted(Comparator.comparingInt(entry -> total - entry.getValue().get()))
		.limit(12)
		.forEachOrdered(entry -> {
			int percent = entry.getValue().get() * 100 / total;
			builder.addField(entry.getKey().toString(), String.format("%s %d%% (%d)", bar(percent, 15), percent, entry.getValue().get()), true);
		});

	return builder.setFooter("Guilds: " + MantaroRPG.getInstance().getGuilds().size(), null);
}
 
開發者ID:Mantaro,項目名稱:MantaroRPG,代碼行數:20,代碼來源:GuildStatsManager.java

示例3: execute

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
protected void execute(CommandEvent event) {
    EmbedBuilder eb = new EmbedBuilder();
    MessageBuilder mb = new MessageBuilder();
    mb.append(Constants.YAY+" All about **GiveawayBot** "+Constants.YAY);
    //eb.setThumbnail("http://i.imgur.com/sCEbmKa.png");
    eb.setTitle("Hold giveaways quickly and easily!");
    eb.setDescription("Hello! I'm **GiveawayBot**, and I'm here to make it as easy as possible to hold "
            + "giveaways on your Discord server! I was created by [**jagrosh**#4824](http://jagrosh.com) "
            + "(<@113156185389092864>) using the [JDA]("+JDAInfo.GITHUB+") library ("+JDAInfo.VERSION+") and "
            + "[JDA-Utilities]("+JDAUtilitiesInfo.GITHUB+") ("+JDAUtilitiesInfo.VERSION+"). Check out my "
            + "commands by typing `!ghelp`, and checkout my website at **http://giveawaybot.party**.");
    eb.addField("\uD83D\uDCCA Stats", bot.getShards().stream().mapToInt(jda -> jda.getGuilds().size()).sum()+" servers\n"+bot.getShards().size()+" shards\n"
            +bot.getShards().stream().mapToInt(jda -> jda.getUsers().size()).sum()+" users", true);
    eb.addField("\uD83C\uDF89 Giveaways", bot.getGiveaways().size()+" right now!", true);
    eb.addField("\uD83C\uDF10 Links", "[Website]("+Constants.WEBSITE+")\n[Invite]("+Constants.INVITE+")\n[Support](https://discord.gg/0p9LSGoRLu6Pet0k)", true);
    eb.setFooter("Last restart", null);
    eb.setTimestamp(Constants.START);
    eb.setColor(Constants.BLURPLE);
    mb.setEmbed(eb.build());
    event.getChannel().sendMessage(mb.build()).queue();
}
 
開發者ID:jagrosh,項目名稱:GiveawayBot,代碼行數:23,代碼來源:AboutCommand.java

示例4: doYaThing

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public void doYaThing(Message message) {
    MessageChannel channel = message.getChannel();
    EmbedBuilder embMsg = new EmbedBuilder();
    try {
        embMsg.setTitle("About DodoBot", "https://github.com/ExidCuter/JDodoBot");
        embMsg.setThumbnail("https://pbs.twimg.com/profile_images/932637770874589186/KgP5zJjH_400x400.jpg");
        embMsg.setColor(new Color(0x13FF00));
        embMsg.addField("Version", ver, true);
        embMsg.addField("By", "Dodo Dodović", true);
        embMsg.addField("Servers", Integer.toString(getNumOfServers()), true);
        embMsg.addField("GitHub", "https://github.com/ExidCuter/JDodoBot", false);
        embMsg.addField("Donate", " https://www.paypal.me/DodoDodovic", false);
        channel.sendMessage(embMsg.build()).complete();
    } catch (Exception e) {
        System.out.println(e.getMessage());
        log.log("ERROR: " + e.getCause() + " " + e.getMessage());
    }
}
 
開發者ID:ExidCuter,項目名稱:JDodoBot,代碼行數:20,代碼來源:About.java

示例5: onMessageReceived

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public void onMessageReceived(MessageReceivedEvent e) {
    String content = e.getMessage().getContent();

    //Never respond to a bot!
    if (e.getAuthor().isBot())
        return;

    //Not the `Invite` command
    if (!content.equalsIgnoreCase(Lib.PREFIX + "Invite")) {
        return;
    }

    //If `Invite` command was received from a non-TextChannel, inform command is Guild-only
    if (!e.isFromType(ChannelType.TEXT)) {
        e.getChannel().sendMessage(Lib.ERROR_GUILDS).queue();
        return;
    }

    EmbedBuilder eb = new EmbedBuilder();
    MessageBuilder mb = new MessageBuilder();
    Lib.receivedcmd++;
    e.getMessage().delete().queue();
    eb.setAuthor(e.getAuthor().getName(),null,e.getAuthor().getEffectiveAvatarUrl());
    eb.addField("Add Uselessbot to your server and type `??Syntax` for Help", "[Auth-Link](https://discordapp.com/oauth2/authorize?client_id=" + e.getJDA().getSelfUser().getId() + "&scope=bot&permissions=-1)" +
            "\nIf you need Help or like to talk to the creator of useless, join: [Invite](https://discord.gg/gKakhJs)", false);
    e.getAuthor().openPrivateChannel().complete().sendMessage(mb.setEmbed(eb.build()).build()).queue();


    Lib.executedcmd++;
}
 
開發者ID:Sanduhr32,項目名稱:Uselessbot,代碼行數:32,代碼來源:Invite.java

示例6: handle

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public void handle(Message message, Event event, String[] args) throws Throwable {
    EmbedBuilder normal = kyoko.getAbstractEmbedBuilder().getNormalBuilder();
    Language l = kyoko.getI18n().getLanguage(message.getGuild());
    normal.addField(kyoko.getI18n().get(l, "ping.message"), kyoko.getJda().getPing() + " ms", true);
    message.getTextChannel().sendMessage(normal.build()).queue();
}
 
開發者ID:gabixdev,項目名稱:Kyoko,代碼行數:8,代碼來源:PingCommand.java

示例7: executeUse

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public void executeUse(Guild guild, Member member, MessageChannel channel) {
    Long guildID = guild.getIdLong();
    Long userID = member.getUser().getIdLong();

    LinkedList<RankUp> rankUps;
    try {
        rankUps = dbMan.addUserExp(guildID, userID, expGain);

        if (!rankUps.isEmpty()) {
            EmbedBuilder newEmbed = new EmbedBuilder();
            Color color = new Color(50, 255, 50);
            newEmbed.setAuthor(member.getEffectiveName(), null, member.getUser().getAvatarUrl());
            newEmbed.setTitle(localize(channel, "item.exp_boost.rank_up"));
            newEmbed.setColor(color);

            for (RankUp newRank : rankUps) {
                newEmbed.addField(member.getEffectiveName(), localize(channel, "item.exp_boost.field.rank_up", newRank.rankName), false);
                if (newRank.expRequired != null) {
                    newEmbed.addField("", localize(channel, "item.exp_boost.field.xp_needed", newRank.expRequired), false);
                } else {
                    newEmbed.addField("", localize(channel, "item.exp_boost.field.max_reached"), false);
                }
            }

            channel.sendMessage(newEmbed.build()).queue();

        }

        dbMan.removeItemFromUser(this.getItemID());

    } catch (SQLException e) {
        e.printStackTrace();
    }
}
 
開發者ID:IANetworks,項目名稱:Ducky-Mc-Duckerson,代碼行數:36,代碼來源:ExpBoostItem.java

示例8: getHelp

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public final EmbedBuilder getHelp(Invoker invoker, EmbedBuilder builder) {
    builder.addField(String.format("%s %s [VoiceChannel] [[URL or Text] [%s/%s] [Maximum Number of Tracks]] [%s]", invoker, Standard.ARGUMENT_PLAY.getCompleteArgument(0, -1), Standard.ARGUMENT_YOUTUBE.getCompleteArgument(0, -1), Standard.ARGUMENT_SOUNDCLOUD.getCompleteArgument(0, -1), Standard.ARGUMENT_LIVE.getCompleteArgument(0, -1)), "Unpauses the bot or plays from an URL or searches on YouTube for a video. If loading more than one video you can set the maximum number of videos that should be loaded, or -1 for all the bot can find. Optionally shows a live track info. Use `VoiceChannel#Number` or its id when there are multiple VoiceChannels with the same name.", false);
    builder.addField(String.format("%s %s [Pause]", invoker, Standard.ARGUMENT_PAUSE.getCompleteArgument(0, -1)), "Toggles or sets pause.", false);
    builder.addField(String.format("%s %s [Times/All]", invoker, Standard.ARGUMENT_SKIP.getCompleteArgument(0, -1)), "Skips 1 or more or even all tracks.", false);
    builder.addField(String.format("%s %s", invoker, Standard.ARGUMENT_STOP.getCompleteArgument(0, -1)), "Stops the music.", false);
    builder.addField(String.format("%s %s [Times]", invoker, Standard.ARGUMENT_SHUFFLE.getCompleteArgument(0, -1)), "Shuffles 1 or more times the queue.", false);
    builder.addField(String.format("%s %s [Loop]", invoker, Standard.ARGUMENT_LOOP.getCompleteArgument(0, -1)), "Toggles or sets looping.", false);
    builder.addField(String.format("%s %s [Playlist]", invoker, Standard.ARGUMENT_INFO.getCompleteArgument(0, -1)), "Shows info about current queue or playlist.", false);
    builder.addField(String.format("%s %s [Page]", invoker, Standard.ARGUMENT_QUEUE.getCompleteArgument(0, -1)), "Shows tracks in current queue and page.", false);
    builder.addField(String.format("%s %s [Volume]", invoker, Standard.ARGUMENT_VOLUME.getCompleteArgument(0, -1)), "Sets or returns the current volume.", false);
    return builder;
}
 
開發者ID:Panzer1119,項目名稱:Supreme-Bot,代碼行數:14,代碼來源:MusicCommand.java

示例9: generateMessage

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
public static final MessageEmbed generateMessage(boolean live, boolean ip) {
    final EmbedBuilder builder = Standard.getMessageEmbed(Color.YELLOW, Standard.toBold((live ? "Live " : "") + "System Information"))
            .addField(String.format("%s Version", Standard.STANDARD_NAME), Standard.VERSION, false)
            .addField("Java Version", System.getProperty("java.version"), false);
    if (ip) {
        builder.addField("IP Address", NetworkUtil.getIPAddress(), false);
    }
    builder.addField("CPU Cores available", "" + Runtime.getRuntime().availableProcessors(), false)
            .addField("Max Memory", getMemory(Runtime.getRuntime().maxMemory()), false)
            .addField("Total Memory", getMemory(Runtime.getRuntime().totalMemory()), false)
            .addField("Free Memory", getMemory(Runtime.getRuntime().freeMemory()), false)
            .addField("Local Server Time", Standard.STANDARD_DATE_TIME_FORMATTER.format(LocalDateTime.now()), false)
            .addField("Converted Time", Standard.STANDARD_DATE_TIME_FORMATTER.format(LocalDateTime.now(Standard.getZoneId())), false);
    return builder.build();
}
 
開發者ID:Panzer1119,項目名稱:Supreme-Bot,代碼行數:16,代碼來源:SystemMessageUpdater.java

示例10: execute

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
protected Message execute(CommandManager.ParsedCommandInvocation parsedCommandInvocation, UserPermissions userPermissions) {
    User user = parsedCommandInvocation.getMessage().getAuthor();
    EmbedBuilder builder = new EmbedBuilder();
    builder.setColor(Colors.COLOR_PRIMARY);
    builder.setAuthor(user.getName(), null, user.getAvatarUrl());
    builder.addField("Points", RubiconBot.getMySQL().getUserValue(user, "points"), true);
    builder.addField("Level", RubiconBot.getMySQL().getUserValue(user, "level"), true);
    builder.addField("Ruby's", RubiconBot.getMySQL().getUserValue(user, "money"), true);
    return new MessageBuilder().setEmbed(builder.build()).build();
}
 
開發者ID:Rubicon-Bot,項目名稱:Rubicon,代碼行數:12,代碼來源:CommandLevel.java

示例11: run

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public boolean run(DiscordBot bot, GuildMessageReceivedEvent event, String args) {
    Guild guild = event.getGuild();
    User owner = guild.getOwner().getUser();
    TextChannel channel = event.getChannel();
    Message message = event.getMessage();
    String memberCount = Long.toString(guild.getMemberCache().size());
    String creationDate = guild.getCreationTime().toLocalDate().toString();
    StringBuilder emojis = new StringBuilder();

    for (Emote emote: guild.getEmotes()) {
        emojis.append(emote.getAsMention());
    }

    String emojiString = emojis.toString();
    emojiString = emojiString.equals("") ? "None" : emojiString;

    EmbedBuilder embed = new EmbedBuilder();
    embed.setAuthor(guild.getName(), null, guild.getIconUrl());
    embed.setColor(new Color(0x4286F4));
    embed.addField("Server Owner", DiscordUtils.getTag(owner), true);
    embed.addField("Member Count", memberCount, true);
    embed.addField("Creation Date", creationDate, true);
    embed.addField("Emojis", emojiString, false);

    DiscordUtils.successReact(bot, message);
    DiscordUtils.sendMessage(channel, embed.build());

    return false;
}
 
開發者ID:Samoxive,項目名稱:SafetyJim,代碼行數:31,代碼來源:Server.java

示例12: onMessageReceived

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public void onMessageReceived(MessageReceivedEvent e) {
    String[] syntax = e.getMessage().getContent().split(" ");

    //Never respond to a bot!
    if (e.getAuthor().isBot())
        return;

    //Not the `Syntax` command
    if (!syntax[0].equalsIgnoreCase(Lib.PREFIX + "Syntax")) {
        return;
    }

    Lib.receivedcmd++;

    if (e.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_MANAGE)) {
        e.getMessage().delete().queue();
    }

    EmbedBuilder eb = new EmbedBuilder();
    MessageBuilder mb = new MessageBuilder();

    if (syntax.length < 2) {
        eb.setAuthor(e.getAuthor().getName(), null, e.getAuthor().getEffectiveAvatarUrl());
        eb.setColor(Lib.ORANGE);
        Lib.getSynMap().forEach((s, s2) ->
                eb.addField(s, s2, false));
        eb.addField("","\n\n*Hint: <...> must be specified but [...] is always optional*", false);
        e.getChannel().sendMessage(mb.setEmbed(eb.build()).build()).queue(msg ->
            msg.delete().queueAfter(30,TimeUnit.SECONDS));
        return;
    }
    if (syntax.length == 2) {
        if (syntax[1].isEmpty()) {
            eb.setColor(Color.red);
            eb.setAuthor("Possible error:", null, Lib.ERROR_PNG);
            eb.setDescription("-" + Lib.ERROR_PERMS + "\n-" + Lib.ERROR_WRONG + "\n-" + Lib.ERROR_EMPTY + "type `"+ Lib.PREFIX + getName() + "`");
            e.getChannel().sendMessage(mb.setEmbed(eb.build()).build()).queue(msg ->
                msg.delete().queueAfter(30,TimeUnit.SECONDS));
            return;
        }
        String val = Lib.getSynMap().get(syntax[1].toLowerCase());
        if (val != null ) {
            eb.setAuthor(e.getAuthor().getName(), null, e.getAuthor().getEffectiveAvatarUrl());
            eb.setColor(Lib.ORANGE);
            eb.addField(syntax[1], val + "\n*Hint: <...> must be specified but [...] is always optional*", false);
            e.getChannel().sendMessage(mb.setEmbed(eb.build()).build()).queue(msg ->
                msg.delete().queueAfter(30,TimeUnit.SECONDS));
        }
        else {
            eb.setColor(Color.red);
            eb.setAuthor("Possible error:", null, Lib.ERROR_PNG);
            eb.setDescription("-" + Lib.ERROR_PERMS + "\n-" + Lib.ERROR_WRONG + "\n-" + Lib.ERROR_EMPTY + "\ntype `"+ Lib.PREFIX + getName() + "`");
            e.getChannel().sendMessage(mb.setEmbed(eb.build()).build()).queue(msg ->
                msg.delete().queueAfter(30,TimeUnit.SECONDS));
        }
    }
    if (syntax.length > 2) {
        eb.setColor(Color.red);
        eb.setAuthor("Possible error:", null, Lib.ERROR_PNG);
        eb.setDescription("-" + Lib.ERROR_PERMS + "\n-" + Lib.ERROR_WRONG + "\n-" + Lib.ERROR_EMPTY + "\n-" + Lib.ERROR_MANY +"\ntype `"+ Lib.PREFIX + getName() + "`");
        e.getChannel().sendMessage(mb.setEmbed(eb.build()).build()).queue(msg ->
            msg.delete().queueAfter(30,TimeUnit.SECONDS));
    }

    Lib.executedcmd++;
}
 
開發者ID:Sanduhr32,項目名稱:Uselessbot,代碼行數:68,代碼來源:Syntax.java

示例13: getHelp

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public EmbedBuilder getHelp(Invoker invoker, EmbedBuilder builder) {
    builder.addField("No Help available yet!", "Im Sorry for you!", false);
    return builder;
}
 
開發者ID:Panzer1119,項目名稱:Supreme-Bot,代碼行數:6,代碼來源:XMLEditorCommand.java

示例14: run

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
public static void run(MessageReceivedEvent e, String arguments, boolean respondToBots) {

        //Never respond to a bot!
        if (e.getAuthor().isBot() != respondToBots) {
            return;
        }

        Lib.receivedcmd++;

        if (e.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_MANAGE)) {
            e.getMessage().delete().queue();
        }

        String OS = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class).getName();
        OS = OS + " " + ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class).getArch() + " " + ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class).getVersion();
        String cpu0 = new DecimalFormat("###.###%").format(ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class).getProcessCpuLoad());
        String cpu2 = new DecimalFormat("###.###%").format(ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class).getSystemCpuLoad());
        int cpu1 = ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors();
        long ram0 = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() / 1000000;
        long ram1 = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax() / 1000000;
        long start = ManagementFactory.getRuntimeMXBean().getStartTime();
        long up = ManagementFactory.getRuntimeMXBean().getUptime();

        Time startt = new Time(start);
        Time upp = new Time(up - 3600000);

        EmbedBuilder eb = new EmbedBuilder();
        MessageBuilder mb = new MessageBuilder();

        eb.setColor(Color.BLUE);
        eb.addField("Operating System:",OS,false);
        eb.addField("Library:","[JDA (Java Discord API) " + JDAInfo.VERSION + "](http://home.dv8tion.net:8080/job/JDA/" + JDAInfo.VERSION_BUILD + "/)", false);
        eb.addField("Times:", "**Started:** " + startt.toString() + "\n**Uptime:** " + upp.toString(), false);
        eb.addField("Bot version:", Useless.VERSION, false);
        eb.addField("CPU:","**Cores:** " + cpu1 + "\n**Usage:** " + cpu0 + " / " + cpu2,false);
        eb.addField("RAM:","**Usage:** " + ram0 +"MB\n**Max:** " + ram1 + "MB", false);

        e.getChannel().sendMessage(mb.setEmbed(eb.build()).build()).queue();

        Lib.executedcmd++;
    }
 
開發者ID:Sanduhr32,項目名稱:Uselessbot,代碼行數:42,代碼來源:Info.java

示例15: onMessageReceived

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public void onMessageReceived(MessageReceivedEvent e) {
    String[] syntax = e.getMessage().getContent().split("\\s+");

    //Never respond to a bot!
    if (e.getAuthor().isBot())
        return;

    //Not the `Help` command
    if (!syntax[0].equalsIgnoreCase(Lib.PREFIX + "Help")) {
        return;
    }

    Lib.receivedcmd++;

    if (e.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_MANAGE)) {
        e.getMessage().delete().queue();
    }

    EmbedBuilder eb = new EmbedBuilder();
    MessageBuilder mb = new MessageBuilder();

    if (syntax.length < 2) {
        eb.setAuthor(e.getAuthor().getName(), null, e.getAuthor().getEffectiveAvatarUrl());
        eb.setColor(Lib.ORANGE);
        Lib.getCmdMap().forEach((s, s2) ->
                eb.addField(s, s2, false));
        e.getChannel().sendMessage(mb.setEmbed(eb.build()).build()).queue(msg ->
            msg.delete().queueAfter(30,TimeUnit.SECONDS));
        Logutils.log.info(e.getAuthor().getName() + " got help");
        return;
    }
    if (syntax.length == 2) {
        if (syntax[1].isEmpty()) {
            eb.setColor(Color.red);
            eb.setAuthor("Possible error:", null, Lib.ERROR_PNG);
            eb.setDescription("-" + Lib.ERROR_PERMS + "\n-" + Lib.ERROR_WRONG + "\n-" + Lib.ERROR_EMPTY + "type `"+ Lib.PREFIX + getName() + "`");
            e.getChannel().sendMessage(mb.setEmbed(eb.build()).build()).queue(msg ->
                msg.delete().queueAfter(30,TimeUnit.SECONDS));
            return;
        }
        String val = Lib.getCmdMap().get(syntax[1].toLowerCase());
        if (val != null ) {
            eb.setAuthor(e.getAuthor().getName(), null, e.getAuthor().getEffectiveAvatarUrl());
            eb.setColor(Lib.ORANGE);
            eb.addField(syntax[1], val, false);
            e.getChannel().sendMessage(mb.setEmbed(eb.build()).build()).queue(msg ->
                msg.delete().queueAfter(30,TimeUnit.SECONDS));
            Logutils.log.info(e.getAuthor().getName() + " got help");
        }
        else {
            eb.setColor(Color.red);
            eb.setAuthor("Possible error:", null, Lib.ERROR_PNG);
            eb.setDescription("-" + Lib.ERROR_PERMS + "\n-" + Lib.ERROR_WRONG + "\n-" + Lib.ERROR_EMPTY + "\ntype `"+ Lib.PREFIX + getName() + "`");
            e.getChannel().sendMessage(mb.setEmbed(eb.build()).build()).queue(msg ->
                msg.delete().queueAfter(30,TimeUnit.SECONDS));
        }
    }
    if (syntax.length > 2) {
        eb.setColor(Color.red);
        eb.setAuthor("Possible error:", null, Lib.ERROR_PNG);
        eb.setDescription("-" + Lib.ERROR_PERMS + "\n-" + Lib.ERROR_WRONG + "\n-" + Lib.ERROR_EMPTY + "\n-" + Lib.ERROR_MANY +"\ntype `"+ Lib.PREFIX + getName() + "`");
        e.getChannel().sendMessage(mb.setEmbed(eb.build()).build()).queue(msg ->
            msg.delete().queueAfter(30,TimeUnit.SECONDS));
    }
    
    Lib.executedcmd++;
}
 
開發者ID:Sanduhr32,項目名稱:Uselessbot,代碼行數:69,代碼來源:Help.java


注:本文中的net.dv8tion.jda.core.EmbedBuilder.addField方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。