本文整理汇总了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();
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}