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


Java EmbedBuilder.setTitle方法代碼示例

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


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

示例1: 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

示例2: renderArticle

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
private MessageEmbed renderArticle(Article article, boolean redirected) {
    if (article == null || StringUtils.isEmpty(article.getRevisionId())) {
        return null;
    }
    EngProcessedPage processedPage = processedPage(article);
    String redirect = lookupRedirect(processedPage);
    if (redirect != null) {
        if (redirected) {
            return null;
        }
        return renderArticle(getArticle(redirect), true);
    }

    EmbedBuilder embedBuilder = messageService.getBaseEmbed();
    try {
        embedBuilder.setTitle(article.getTitle(), WIKI_URL + UriUtils.encode(article.getTitle(), "UTF-8"));
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
    }
    TextConverter converter = new TextConverter(config, embedBuilder);
    return (MessageEmbed) converter.go(processedPage.getPage());
}
 
開發者ID:GoldRenard,項目名稱:JuniperBotJ,代碼行數:23,代碼來源:WikiFurService.java

示例3: getHelpCard

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
protected static MessageEmbed getHelpCard(CommandEvent e, Command c) {
    EmbedBuilder eb = new EmbedBuilder().setColor(e.getGuild().getMember(e.getJDA().getSelfUser()).getColor());
    eb.setTitle(c.getName().substring(0, 1).toUpperCase() + c.getName().substring(1) + " Command Help Card:", null);
    String argument = c.getArguments() == null ? "" : c.getArguments();
    eb.addField("Usage", e.getClient().getPrefix() + c.getName() + " " + argument, false);
    eb.addField("Description", c.getHelp(), false);
    String r;
    if (c.getAliases().length == 0)
        r = Locale.getCommandMessage("no-alias").finish();
    else
        r = Arrays.toString(c.getAliases()).replaceAll("\\[", "").replaceAll("]", "");
    eb.addField("Alias", r, false);
    String permission = c.getUserPermissions().length < 1 ? "None" : Arrays.toString(c.getUserPermissions());
    if (c.isOwnerCommand())
        permission = "OWNER";
    if (c.getCategory().equals(Bot.ADMIN))
        permission = "ADMIN";
    eb.addField("Permission", "Required Permission: " + permission, false);
    return eb.build();
}
 
開發者ID:CyR1en,項目名稱:Minecordbot,代碼行數:21,代碼來源:MCBCommand.java

示例4: 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;
}
 
開發者ID:GoldRenard,項目名稱:JuniperBotJ,代碼行數:20,代碼來源:ServerInfoCommand.java

示例5: GameBotCommand

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
public GameBotCommand() {
    this.name = "gamebot";
    this.aliases = new String[]{"gb"};
    this.help = "type " + Constant.prefix + "gameBot help";
    this.helpBiConsumer = (CommandEvent event, Command command) -> {
        EmbedBuilder builder = new EmbedBuilder();
        builder.setColor(event.isFromType(ChannelType.TEXT) ? event.getSelfMember().getColor() : Color.GREEN);
        builder.setFooter(event.getSelfUser().getName(), event.getSelfUser().getAvatarUrl());
        builder.setTitle("The \"Game Bot\" Feature");
        builder.setDescription("The \"Game Bot\" feature is quite simple:");
        builder.addField("1.", "If you're playing a game, you just have to go in the server's game channel and react with :ok: in the bot channel", false);
        builder.addField("2.", "After that you'll be moved in a channel with the name of your game", false);
        builder.addField("3.", "If you leave the channel, it will automatically delete the channel", false);
        builder.setImage(Constant.gameBotExampleUrl);
        event.reply(builder.build());
    };
    this.guildOnly = false;
    this.ownerCommand = false;
}
 
開發者ID:elgoupil,項目名稱:GoupilBot,代碼行數:20,代碼來源:GameBotCommand.java

示例6: replyError

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public void replyError(Config config, CommandEvent commandEvent, Throwable throwable, LocaleService localeService) {
    if (config != null && config.getReplyInDmWhenPossible()) {
        commandEvent.replyInDM(throwable.getMessage());
        commandEvent.reactError();
    } else {
        commandEvent.reactError();
        EmbedBuilder embedBuilder = new EmbedBuilder();
        embedBuilder.setAuthor(null, null, null);
        embedBuilder.setTitle(null);
        embedBuilder.setDescription(throwable.getMessage());
        final String msgRemoveText = localeService.getMessageFor(LocaleService.ERROR_KEEP_CHAT_CLEAN,
                localeService.getLocaleForUser(commandEvent.getAuthor()),
                String.valueOf(BotServerMain.timeToRemoveFeedbackInSeconds));
        embedBuilder.setFooter(msgRemoveText, null);
        final MessageEmbed messageEmbed = embedBuilder.build();
        replyThenDeleteFeedbackAndOriginMessageAfterXTime(commandEvent, messageEmbed,
                BotServerMain.timeToRemoveFeedbackInSeconds, TimeUnit.SECONDS);
    }
}
 
開發者ID:magnusmickelsson,項目名稱:pokeraidbot,代碼行數:21,代碼來源:DefaultFeedbackStrategy.java

示例7: replyError

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public void replyError(Config config, CommandEvent commandEvent, Throwable throwable, LocaleService localeService) {
    if (config != null && config.getReplyInDmWhenPossible()) {
        commandEvent.replyInDM(throwable.getMessage());
        commandEvent.reactError();
    } else {
        commandEvent.reactError();
        EmbedBuilder embedBuilder = new EmbedBuilder();
        embedBuilder.setAuthor(null, null, null);
        embedBuilder.setTitle(null);
        embedBuilder.setDescription(throwable.getMessage());
        final MessageEmbed messageEmbed = embedBuilder.build();
        commandEvent.reply(messageEmbed);
    }
}
 
開發者ID:magnusmickelsson,項目名稱:pokeraidbot,代碼行數:16,代碼來源:KeepAllFeedbackStrategy.java

示例8: 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

示例9: createChannels

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
private EmbedBuilder createChannels(Guild guild) {
    String[] channels = RubiconBot.getMySQL().getGuildValue(guild, "blacklist").split(",");
    StringBuilder channelnames = new StringBuilder();
    Arrays.asList(channels).forEach(c -> {
        TextChannel channel = guild.getTextChannelById(c);
        channelnames.append(channel.getName() + "`(" + channel.getId() + ")`, ");
    });
    channelnames.replace(channelnames.lastIndexOf(","), channelnames.lastIndexOf(",") + 1, "");
    EmbedBuilder embed = new EmbedBuilder();
    embed.setColor(Colors.COLOR_SECONDARY);
    embed.setTitle("Blacklisted channels");
    embed.setAuthor(guild.getName(), guild.getIconUrl());
    embed.setDescription(channelnames.toString());
    return embed;
}
 
開發者ID:Rubicon-Bot,項目名稱:Rubicon,代碼行數:16,代碼來源:CommandBlacklist.java

示例10: executeCommand

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public void executeCommand(Message msg) {
	GuildObject g = GuildObject.guildMap.get(msg.getGuild().getId());
	String roleName = Util.getCommandContents(msg);
	String currentRoleId = g.getConfig().getAutoAssignRoleId();
	EmbedBuilder em = new EmbedBuilder();
	if (roleName.isEmpty()) {
		MessageUtils.sendIncorrectCommandUsage(msg, this);
		return;
	}
	
	List<Role> roles = msg.getGuild().getRolesByName(roleName, true);
	if (roles.isEmpty()) {
		em.setTitle("Error", null)
		.setColor(Color.RED)
		.setDescription(String.format("No role named %s found", roleName));
		msg.getChannel().sendMessage(em.build()).queue();
		return;
	}
	Role r = roles.get(0);
	em.setTitle("Success", null);
	if (currentRoleId.equals(r.getId())) {
		em.setColor(Util.resolveColor(msg.getMember(), Color.CYAN))
		.setDescription(String.format("Removed **%s** as your auto assigned role", r.getName()));
		g.getConfig().setAutoAssignRoleId("");
	} else {
		em.setColor(Util.resolveColor(msg.getMember(), Color.CYAN))
		.setDescription(String.format("Set **%s** as your auto assigned role", r.getName()));
		g.getConfig().setAutoAssignRoleId(r.getId());
	}
	
	msg.getChannel().sendMessage(em.build()).queue();
}
 
開發者ID:paul-io,項目名稱:momo-2,代碼行數:34,代碼來源:SetAutoRole.java

示例11: execute

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
protected Message execute(CommandManager.ParsedCommandInvocation parsedCommandInvocation, UserPermissions userPermissions) {
    Message message = parsedCommandInvocation.getMessage();
    User info;
    String[] args = parsedCommandInvocation.getArgs();
    if (args.length > 0) {
        if (message.getMentionedUsers().size() > 0)
            info = message.getMentionedUsers().get(0);
        else {
            return createHelpMessage();
        }
    } else {
        info = message.getAuthor();
    }

    Member user = message.getGuild().getMember(info);
    StringBuilder rawRoles = new StringBuilder();
    user.getRoles().forEach(r -> rawRoles.append(r.getName()).append(", "));
    StringBuilder roles = new StringBuilder(rawRoles.toString());
    if (!user.getRoles().isEmpty())
        roles.replace(rawRoles.lastIndexOf(","), roles.lastIndexOf(",") + 1, "");
    EmbedBuilder userinfo = new EmbedBuilder();
    userinfo.setColor(Colors.COLOR_PRIMARY);
    userinfo.setTitle("User information of " + user.getUser().getName());
    userinfo.setThumbnail(info.getAvatarUrl());
    userinfo.addField("Nickname", user.getEffectiveName(), false);
    userinfo.addField("User id", info.getId(), false);
    userinfo.addField("Status", user.getOnlineStatus().toString().replace("_", ""), false);
    if (user.getGame() != null)
        userinfo.addField("Game", user.getGame().toString(), false);
    userinfo.addField("Guild join date", formatDate(user.getJoinDate()), false);
    userinfo.addField("Roles", "`" + roles.toString() + "`", false);
    userinfo.addField("Discord join date", formatDate(info.getCreationTime()), false);
    userinfo.addField("Avatar url", info.getAvatarUrl(), true);
    userinfo.addField("--- RubiconBot Stats ---", "" +
            "Level: " + RubiconBot.getMySQL().getUserValue(user.getUser(), "level") + "\n" +
            "Ruby's: " + RubiconBot.getMySQL().getUserValue(user.getUser(), "money"), true);
    return new MessageBuilder().setEmbed(userinfo.build()).build();
}
 
開發者ID:Rubicon-Bot,項目名稱:Rubicon,代碼行數:40,代碼來源:CommandUserInfo.java

示例12: createEmbedMessage

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
/**
 * Creates a simple embedded message
 */
public static MessageEmbed createEmbedMessage(Color colour, @Nullable String title, @Nullable String description)
{
    EmbedBuilder builder = new EmbedBuilder();
    builder.setColor(colour);
    if(title != null)
        builder.setTitle(title);
    if(description != null)
        builder.setDescription(description);
    return builder.build();
}
 
開發者ID:thebrightspark,項目名稱:MDC-Discord-Bot,代碼行數:14,代碼來源:Util.java

示例13: run

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
public Result run(String[] args, MessageReceivedEvent e) throws Exception {
	
	//Check for argument length.
	if (args.length == 0) {
		return new Result(Outcome.WARNING, ":warning: You must specify an item!");
	}
	
	//Search through the item database
	Item item = Item.search(Item.values(), Item.prepareArgs(args));
	
	MessageUtils.log(
		"Item command executed" +
		"\nCommand: `" + e.getMessage().getContent() + "`" +
		"\nItem: `" + item + "`"
	);
	
	//If nothing is found
	if (item == null) {
		return new Result(Outcome.WARNING,
			":warning: That item does not exist! " +
			"\n" + "Did you spell it correctly?");
	}
	
	//Build message
	EmbedBuilder eb = item.getInfo();
	eb.setTitle(item.name);
	eb.setColor(Color.GREEN);
	eb.setFooter("See an error? Please report them at https://goo.gl/KWCxis", null);
	//eb = MessageUtils.addFooter(eb);
	
	return new Result(Outcome.SUCCESS, eb.build());
}
 
開發者ID:Tisawesomeness,項目名稱:Minecord,代碼行數:33,代碼來源:ItemCommand.java

示例14: reply

import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public void reply(Config config, CommandEvent commandEvent, String message) {
    if (config != null && config.getReplyInDmWhenPossible()) {
        commandEvent.replyInDM(message);
        commandEvent.reactSuccess();
    } else {
        EmbedBuilder embedBuilder = new EmbedBuilder();
        embedBuilder.setAuthor(null, null, null);
        embedBuilder.setTitle(null);
        embedBuilder.setDescription(message);
        commandEvent.reply(embedBuilder.build());
    }
}
 
開發者ID:magnusmickelsson,項目名稱:pokeraidbot,代碼行數:14,代碼來源:KeepAllFeedbackStrategy.java

示例15: 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) {
    }
}
 
開發者ID:elgoupil,項目名稱:GoupilBot,代碼行數:40,代碼來源:NowPlaying.java


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