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


Java MessageBuilder.build方法代码示例

本文整理汇总了Java中net.dv8tion.jda.core.MessageBuilder.build方法的典型用法代码示例。如果您正苦于以下问题:Java MessageBuilder.build方法的具体用法?Java MessageBuilder.build怎么用?Java MessageBuilder.build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.dv8tion.jda.core.MessageBuilder的用法示例。


在下文中一共展示了MessageBuilder.build方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import net.dv8tion.jda.core.MessageBuilder; //导入方法依赖的package包/类
public Message render(Color color, Instant now)
{
    MessageBuilder mb = new MessageBuilder();
    boolean close = now.plusSeconds(6).isAfter(end);
    mb.append(Constants.YAY).append(close ? " **G I V E A W A Y** " : "   **GIVEAWAY**   ").append(Constants.YAY);
    EmbedBuilder eb = new EmbedBuilder();
    if(close)
        eb.setColor(Color.RED);
    else if(color==null)
        eb.setColor(Constants.BLURPLE);
    else
        eb.setColor(color);
    eb.setFooter((winners==1 ? "" : winners+" Winners | ")+"Ends at",null);
    eb.setTimestamp(end);
    eb.setDescription("React with "+Constants.TADA+" to enter!\nTime remaining: "+FormatUtil.secondsToTime(now.until(end, ChronoUnit.SECONDS)));
    if(prize!=null)
        eb.setAuthor(prize, null, null);
    if(close)
        eb.setTitle("Last chance to enter!!!", null);
    mb.setEmbed(eb.build());
    return mb.build();
}
 
开发者ID:jagrosh,项目名称:GiveawayBot,代码行数:23,代码来源:Giveaway.java

示例2: createMessage

import net.dv8tion.jda.core.MessageBuilder; //导入方法依赖的package包/类
public static Message createMessage(String title, String description, boolean success){
	MessageBuilder embed = new MessageBuilder();
	Color color;
	if(success){
		color = Color.green;
	}else{
		color = Color.red;
	}
	if(title != null && !title.isEmpty()){
		embed.append(String.format("`%s`", title.replaceAll("`", "")));
	}
	if(description != null && !description.isEmpty()){
		embed.setEmbed(new EmbedBuilder().setDescription(description.replaceAll("`", "")).setColor(color).build());
	}
	
	return embed.build();
}
 
开发者ID:Implosions,项目名称:BullyBot,代码行数:18,代码来源:Utils.java

示例3: replyWithName

import net.dv8tion.jda.core.MessageBuilder; //导入方法依赖的package包/类
public static Message replyWithName(TextChannel channel, Member member, String msg) {
    msg = ensureSpace(msg);

    MessageBuilder builder = new MessageBuilder().append(member.getEffectiveName()).append(": ").append(msg);
    Message mes = builder.build();
    channel.sendMessage(mes).queue();
    return mes;
}
 
开发者ID:Frederikam,项目名称:GensokyoBot,代码行数:9,代码来源:TextUtils.java

示例4: renderPage

import net.dv8tion.jda.core.MessageBuilder; //导入方法依赖的package包/类
private Message renderPage(int pageNum)
{
    MessageBuilder mbuilder = new MessageBuilder();
    EmbedBuilder ebuilder = new EmbedBuilder();
    ebuilder.setImage(urls.get(pageNum-1));
    ebuilder.setColor(color.apply(pageNum, urls.size()));
    ebuilder.setDescription(description.apply(pageNum, urls.size()));
    if(showPageNumbers)
        ebuilder.setFooter("Image "+pageNum+"/"+urls.size(), null);
    mbuilder.setEmbed(ebuilder.build());
    if(text!=null)
        mbuilder.append(text.apply(pageNum, urls.size()));
    return mbuilder.build();
}
 
开发者ID:JDA-Applications,项目名称:JDA-Utilities,代码行数:15,代码来源:Slideshow.java

示例5: getMessage

import net.dv8tion.jda.core.MessageBuilder; //导入方法依赖的package包/类
private Message getMessage()
{
    MessageBuilder mbuilder = new MessageBuilder();
    if(text!=null)
        mbuilder.append(text);
    if(description!=null)
        mbuilder.setEmbed(new EmbedBuilder().setColor(color).setDescription(description).build());
    return mbuilder.build();
}
 
开发者ID:JDA-Applications,项目名称:JDA-Utilities,代码行数:10,代码来源:ButtonMenu.java

示例6: renderPage

import net.dv8tion.jda.core.MessageBuilder; //导入方法依赖的package包/类
private Message renderPage(int pageNum)
{
    MessageBuilder mbuilder = new MessageBuilder();
    EmbedBuilder ebuilder = new EmbedBuilder();
    int start = (pageNum-1)*itemsPerPage;
    int end = strings.size() < pageNum*itemsPerPage ? strings.size() : pageNum*itemsPerPage;
    switch(columns)
    {
        case 1:
            StringBuilder sbuilder = new StringBuilder();
            for(int i=start; i<end; i++)
                sbuilder.append("\n").append(numberItems ? "`"+(i+1)+".` " : "").append(strings.get(i));
            ebuilder.setDescription(sbuilder.toString());
            break;
        default:
            int per = (int)Math.ceil((double)(end-start)/columns);
            for(int k=0; k<columns; k++)
            {
                StringBuilder strbuilder = new StringBuilder();
                for(int i=start+k*per; i<end && i<start+(k+1)*per; i++)
                    strbuilder.append("\n").append(numberItems ? (i+1)+". " : "").append(strings.get(i));
                ebuilder.addField("", strbuilder.toString(), true);
            }
    }
    
    ebuilder.setColor(color.apply(pageNum, pages));
    if(showPageNumbers)
        ebuilder.setFooter("Page "+pageNum+"/"+pages, null);
    mbuilder.setEmbed(ebuilder.build());
    if(text!=null)
        mbuilder.append(text.apply(pageNum, pages));
    return mbuilder.build();
}
 
开发者ID:JDA-Applications,项目名称:JDA-Utilities,代码行数:34,代码来源:Paginator.java

示例7: getMessage

import net.dv8tion.jda.core.MessageBuilder; //导入方法依赖的package包/类
private Message getMessage()
{
    MessageBuilder mbuilder = new MessageBuilder();
    if(text!=null)
        mbuilder.append(text);
    StringBuilder sb = new StringBuilder();
    for(int i=0; i<choices.size(); i++)
        sb.append("\n").append(getEmoji(i+1)).append(" ").append(choices.get(i));
    mbuilder.setEmbed(new EmbedBuilder().setColor(color).setDescription(description==null ? sb.toString() : description+sb.toString()).build());
    return mbuilder.build();
}
 
开发者ID:JDA-Applications,项目名称:JDA-Utilities,代码行数:12,代码来源:OrderedMenu.java

示例8: doCommand

import net.dv8tion.jda.core.MessageBuilder; //导入方法依赖的package包/类
@Override
protected void doCommand(CommandEvent event) {
    MessageBuilder message = new MessageBuilder();
    event.reply(message.appendCodeBlock(parser.getRandomQuote(), "").getStringBuilder().toString() + "\n-" + parser.getAuthor());
    message.build();
}
 
开发者ID:thebrightspark,项目名称:MDC-Discord-Bot,代码行数:7,代码来源:CommandRandQuote.java

示例9: prefaceWithName

import net.dv8tion.jda.core.MessageBuilder; //导入方法依赖的package包/类
public static Message prefaceWithName(Member member, String msg) {
    msg = ensureSpace(msg);

    MessageBuilder builder = new MessageBuilder().append(member.getEffectiveName()).append(": ").append(msg);
    return builder.build();
}
 
开发者ID:Frederikam,项目名称:GensokyoBot,代码行数:7,代码来源:TextUtils.java

示例10: createEmbed

import net.dv8tion.jda.core.MessageBuilder; //导入方法依赖的package包/类
public Message createEmbed(Color color, String title, String desc) {
  MessageBuilder mb = new MessageBuilder();
  mb.setEmbed(
      new EmbedBuilder().setColor(color).setTitle(title, null).setDescription(desc).build());
  return mb.build();
}
 
开发者ID:Svetroid,项目名称:Hobbes-v1,代码行数:7,代码来源:Command.java


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