本文整理匯總了Java中net.dv8tion.jda.core.EmbedBuilder.setFooter方法的典型用法代碼示例。如果您正苦於以下問題:Java EmbedBuilder.setFooter方法的具體用法?Java EmbedBuilder.setFooter怎麽用?Java EmbedBuilder.setFooter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.dv8tion.jda.core.EmbedBuilder
的用法示例。
在下文中一共展示了EmbedBuilder.setFooter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: render
import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的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: reply
import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public void reply(Config config, CommandEvent commandEvent, String message, int numberOfSecondsBeforeRemove,
LocaleService localeService) {
// Give the caller some slack but not much
Validate.isTrue(numberOfSecondsBeforeRemove > 5);
if (config != null && config.getReplyInDmWhenPossible()) {
commandEvent.replyInDM(message);
commandEvent.reactSuccess();
} else {
commandEvent.reactSuccess();
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor(null, null, null);
embedBuilder.setTitle(null);
embedBuilder.setDescription(message);
final String msgRemoveText = localeService.getMessageFor(LocaleService.KEEP_CHAT_CLEAN,
localeService.getLocaleForUser(commandEvent.getAuthor()), "" +
numberOfSecondsBeforeRemove);
embedBuilder.setFooter(msgRemoveText, null);
sendMessageThenDeleteAfterXSeconds(commandEvent, embedBuilder.build(),
numberOfSecondsBeforeRemove, TimeUnit.SECONDS);
}
}
示例3: onCommand
import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@RegisterCommand(aliases = "help")
public void onCommand(Message message) {
EmbedBuilder embed = new EmbedBuilder();
embed.setAuthor("ZLevels Help - Command List", null, null);
embed.setColor(Color.decode(Config.EMBED_COLOUR));
embed.setFooter("Written by ZP4RKER", "https://github.com/ZP4RKER");
compileList(embed);
try {
message.getAuthor().openPrivateChannel().complete().sendMessage(embed.build()).complete();
} catch (Exception e) {
ZLogger.warn("Could not open DM channel or already open.");
}
}
示例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;
}
示例5: execute
import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public void execute(String[] args, Event event, TaverneBot bot) {
MessageReceivedEvent mre = (MessageReceivedEvent) event;
EmbedBuilder builder = new EmbedBuilder();
builder.setColor(new Color(192, 57, 43));
builder.setFooter("TaverneBot", null);
if(args.length>=2) {
User u = mre.getMessage().getMentionedUsers().get(0);
if(u.isBot()) return;
builder.setAuthor(u.getName(), null, u.getAvatarUrl()+"?size=256");
builder.addField("Classement", String.valueOf(bot.getScoreboard().getRank(u)), true);
builder.addField("Niveaux", String.valueOf(bot.getLevelManager().getLevel(u)), true);
builder.addField("Exp�riences", String.valueOf(bot.getLevelManager().getXP(u)), true);
} else {
builder.setAuthor(mre.getAuthor().getName(), null, mre.getAuthor().getAvatarUrl()+"?size=256");
builder.addField("Classement", String.valueOf(bot.getScoreboard().getRank(mre.getAuthor())), true);
builder.addField("Niveaux", String.valueOf(bot.getLevelManager().getLevel(mre.getAuthor())), true);
builder.addField("Exp�riences", String.valueOf(bot.getLevelManager().getXP(mre.getAuthor())), true);
}
((MessageReceivedEvent) event).getTextChannel().sendMessage(builder.build()).queue();
}
示例6: createMythicEmbed
import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
/**
* Create an embed of a Mythic week
* @param weekAffixes The affixes to add to the embed.
* @return A {@link EmbedBuilder} to send to the user.
*/
public static EmbedBuilder createMythicEmbed(LegendaryBot bot, Guild guild, String[] weekAffixes) {
EmbedBuilder eb = new EmbedBuilder();
eb.setThumbnail("http://wow.zamimg.com/images/wow/icons/large/inv_relics_hourglass.jpg");
eb.setFooter(bot.getTranslateManager().translate(guild,"mythicplus.affixes"), "http://wow.zamimg.com/images/wow/icons/large/inv_relics_hourglass.jpg");
AffixDescription affix4 = Utils.affixDescription.get(weekAffixes[0]);
AffixDescription affix7 = Utils.affixDescription.get(weekAffixes[1]);
AffixDescription affix10 = Utils.affixDescription.get(weekAffixes[2]);
int difficulty = affix4.getDifficulty() + affix7.getDifficulty() + affix10.getDifficulty();
if (difficulty <= 3) {
eb.setColor(Color.GREEN);
} else if (difficulty == 4) {
eb.setColor(Color.YELLOW);
} else {
eb.setColor(Color.RED);
}
//TODO link the proper language wowhead site for the language of the guild
eb.addField("(4) " + bot.getTranslateManager().translate(guild,"affix."+weekAffixes[0].toLowerCase()+".name"),bot.getTranslateManager().translate(guild, "affix."+weekAffixes[0].toLowerCase() + ".description") + "\n[" + bot.getTranslateManager().translate(guild, "more.info")+"](http://www.wowhead.com/affix="+affix4.getId()+")",false);
eb.addField("(7) " +bot.getTranslateManager().translate(guild,"affix."+weekAffixes[1].toLowerCase()+".name"),bot.getTranslateManager().translate(guild, "affix."+weekAffixes[1].toLowerCase() + ".description") + "\n[" + bot.getTranslateManager().translate(guild, "more.info")+"](http://www.wowhead.com/affix="+affix7.getId()+")",false);
eb.addField("(10) " + bot.getTranslateManager().translate(guild,"affix."+weekAffixes[2].toLowerCase()+".name"),bot.getTranslateManager().translate(guild, "affix."+weekAffixes[2].toLowerCase() + ".description") + "\n[" + bot.getTranslateManager().translate(guild, "more.info")+"](http://www.wowhead.com/affix="+affix10.getId()+")",false);
return eb;
}
示例7: 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) {
}
}
示例8: execute
import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
protected void execute(CommandEvent event)
{
String args = event.getArgs();
if(config.getGihpyKey().isEmpty())
{
event.replyError("This command has been disabled due a faulty parameter on the config file, ask the Owner to check the Console");
LOG.warn("Someone triggered the Giphy command, but there isn't a key in the config file. In order to stop this message add a key to the config file.");
return;
}
if(args.isEmpty())
{
event.replyWarning("No search terms specified!");
return;
}
Color color;
if(event.isFromType(ChannelType.PRIVATE))
color = Color.decode("#33ff00");
else
color = event.getMember().getColor();
SimpleGiphy.setApiKey(config.getGihpyKey());
RandomGiphyResponse r;
EmbedBuilder builder = new EmbedBuilder();
String title = "<:giphy:373675520099090436> Random Giphy Image:";
r = SimpleGiphy.getInstance().random(args, "pg-13");
RandomGiphy gif = r.getRandomGiphy();
builder.setImage(gif.getImageOriginalUrl());
builder.setFooter("GIF provided by Giphy API", "https://cdn.discordapp.com/attachments/304027425509998593/373674151472267265/Poweredby_640px_Badge.gif");
builder.setColor(color);
event.reply(new MessageBuilder().append(title).setEmbed(builder.build()).build());
}
示例9: execute
import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
protected void execute(CommandEvent event)
{
try
{
Color color;
if(event.isFromType(ChannelType.PRIVATE))
color = Color.decode("#33ff00");
else
color = event.getMember().getColor();
EmbedBuilder builder = new EmbedBuilder();
OkHttpClient client = new OkHttpClient();
Request req = new Request.Builder().url("https://random.cat/meow").get().build();
Response res = client.newCall(req).execute();
if(!res.isSuccessful())
throw new RuntimeException("Error while fetching remote resource");
ResponseBody body = res.body();
String data = body.string();
JSONObject json = new JSONObject(data);
String cat = json.getString("file");
builder.setAuthor("Requested by "+event.getAuthor().getName(), null, event.getAuthor().getEffectiveAvatarUrl());
builder.setImage(cat);
builder.setFooter("Image provided by random.cat API", null);
builder.setColor(color);
event.reply(builder.build());
}
catch(IOException | RuntimeException e)
{
event.replyError("An error was thrown when getting the image! Ask the Owner to check the Console.");
LOG.error(e.getMessage());
if (config.isDebugEnabled())
e.printStackTrace();
}
}
示例10: getBaseEmbed
import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public EmbedBuilder getBaseEmbed(boolean copyright) {
EmbedBuilder builder = new EmbedBuilder().setColor(accentColor);
if (copyright) {
builder.setFooter(getMessage("about.copy.content"), copyImageUrl);
}
return builder;
}
示例11: 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());
}
示例12: getEmbedWithThumbnailAndFooter
import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的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();
}
示例13: executeCommand
import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
public void executeCommand(Message msg) {
EmbedBuilder em = new EmbedBuilder();
String contents = Util.getCommandContents(msg);
if(contents.isEmpty()) {
MessageUtils.sendIncorrectCommandUsage(msg, this);
return;
}
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(KitsuAPI.ENDPOINT)
.client(RESTCache.client)
.addConverterFactory(GsonConverterFactory.create())
.build();
KitsuAPI api = retrofit.create(KitsuAPI.class);
Call<KitsuAnime> call = api.getAnime(contents);
try {
KitsuAnime anime;
if((anime = call.execute().body()) == null) {
em.setTitle("Error", null)
.setColor(Color.RED)
.setDescription(String.format("No anime results found for **%s**", contents));
msg.getChannel().sendMessage(em.build()).queue();
return;
}
em.setTitle(anime.getData().get(0).getAttributes().getCanonicalTitle(),
"https://kitsu.io/anime/" + anime.getData().get(0).getAttributes().getSlug())
.setColor(Util.resolveColor(Util.memberFromMessage(msg), Color.GREEN));
if(anime.getData().get(0).getAttributes().getCoverImage() != null)
em.setImage(anime.getData().get(0).getAttributes().getCoverImage().getOriginal());
em.addField("Type", WordUtils.capitalize(anime.getData().get(0).getType()), true);
if(Util.isDouble(anime.getData().get(0).getAttributes().getAverageRating() + ""))
em.addField("Rating",
(new DecimalFormat(".##").format(anime.getData().get(0).getAttributes().getAverageRating())) + "/100", true);
em.addField("Episodes", anime.getData().get(0).getAttributes().getEpisodeCount() == null ? "not yet aired" :
anime.getData().get(0).getAttributes().getEpisodeCount() + "", true);
StringBuilder aired = new StringBuilder();
if(anime.getData().get(0).getAttributes().getStartDate() != null)
aired.append(anime.getData().get(0).getAttributes().getStartDate());
if(anime.getData().get(0).getAttributes().getEndDate() != null)
aired.append(" -\n" + anime.getData().get(0).getAttributes().getEndDate());
if(aired.length() > 0)
em.addField("Airing Dates", aired.toString(), true);
if(anime.getData().get(0).getAttributes().getSynopsis().length() > 800)
anime.getData().get(0).getAttributes().setSynopsis(anime.getData().get(0).getAttributes().getSynopsis().substring(0, 700) + "...");
em.addField("Synopsis", anime.getData().get(0).getAttributes().getSynopsis(), false);
em.setFooter("information from kitsu.io", null);
msg.getChannel().sendMessage(em.build()).queue();
} catch (IOException e) {
e.printStackTrace();
}
}
示例14: execute
import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
protected void execute(CommandEvent event) {
if (event.isFromType(ChannelType.TEXT)) {
String id = Constant.getTextChannelConf().getProperty(event.getGuild().getId());
if (id != null) {
if (!event.getChannel().getId().equals(id)) {
return;
}
}
}
if (event.getGuild().getAudioManager().isConnected()) {
GuildMusicManager musicManager = Constant.music.getGuildAudioPlayer(event.getGuild());
if (musicManager.player.getPlayingTrack() != null) {
ArrayList<AudioTrack> queue = new ArrayList<>(musicManager.scheduler.getQueue());
String message = "";
EmbedBuilder builder = new EmbedBuilder();
builder.setTitle("Current queue:");
builder.setColor(event.getGuild().getSelfMember().getColor());
if (queue.size() > 4) {
message += "1.`" + musicManager.player.getPlayingTrack().getInfo().title + "`";
for (int i = 0; i < 4; i++) {
message += "\n" + (i + 2) + ".`" + queue.get(i).getInfo().title + "`";
}
message += "\n\nAnd `" + (queue.size() - 4) + "` more...";
builder.setDescription(message);
event.reply(builder.build());
} else if (queue.isEmpty()) {
event.replyWarning("The queue is empty");
} else if (queue.size() <= 4) {
message += "1.`" + musicManager.player.getPlayingTrack().getInfo().title + "`";
for (int i = 0; i < queue.size(); i++) {
message += "\n" + (i + 2) + ".`" + queue.get(i).getInfo().title + "`";
}
builder.setDescription(message);
builder.setFooter(event.getSelfMember().getNickname() != null ? event.getSelfMember().getNickname() : event.getSelfMember().getEffectiveName(), event.getGuild().getIconUrl());
event.reply(builder.build());
}
}
} else {
event.replyError(event.getMember().getAsMention() + " I'm not even connected :joy:");
}
}
示例15: execute
import net.dv8tion.jda.core.EmbedBuilder; //導入方法依賴的package包/類
@Override
protected void execute(CommandEvent event)
{
EmbedBuilder builder = new EmbedBuilder();
String[] inputs = event.getArgs().split("\\s+", 2);
int num = 1;
String query;
if(inputs.length>1 && inputs[0].matches("\\d+"))
{
num = Integer.parseInt(inputs[0]);
query = inputs[1];
}
else
{
query = event.getArgs();
}
if(num<1 || num>10)
{
event.replyWarning("I can only get 1 to 10 results at once!");
return;
}
ArrayList<String> results = searcher.getGoogleData(query);
if(results==null)
{
event.replyWarning("An error ocurred when using Google Search. Ask the bot owner to see the console.");
}
else if(results.isEmpty())
{
event.replyWarning("Any results found for `"+query+"`!");
}
else
{
StringBuilder output = new StringBuilder("`"+query+"` \uD83D\uDD0E "+results.get(0));
if(num>1 && results.size()>1)
{
output.append("\n See also:");
for(int i=1; i<num && i<results.size(); i++)
{
output.append("\n<").append(results.get(i)).append(">");
}
}
builder.setAuthor(event.getAuthor().getName(), null, event.getAuthor().getEffectiveAvatarUrl());
builder.setDescription(output.toString());
builder.setColor(event.getMessage().getMember().getColor());
builder.setFooter("Results from Google Search API", null);
event.reply(builder.build());
}
}