discord4j.core.spec.EmbedCreateSpec Java Examples
The following examples show how to use
discord4j.core.spec.EmbedCreateSpec.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CalendarMessageFormatter.java From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 | 6 votes |
public static Consumer<EmbedCreateSpec> getCalendarLinkEmbed(Calendar cal, GuildSettings settings) { return spec -> { Guild guild = DisCalClient.getClient().getGuildById(settings.getGuildID()).block(); if (settings.isBranded() && guild != null) spec.setAuthor(guild.getName(), GlobalConst.discalSite, guild.getIconUrl(Image.Format.PNG).orElse(GlobalConst.iconUrl)); else spec.setAuthor("DisCal", GlobalConst.discalSite, GlobalConst.iconUrl); spec.setTitle(MessageManager.getMessage("Embed.Calendar.Link.Title", settings)); if (cal.getSummary() != null) spec.addField(MessageManager.getMessage("Embed.Calendar.Link.Summary", settings), cal.getSummary(), true); if (cal.getDescription() != null) spec.addField(MessageManager.getMessage("Embed.Calendar.Link.Description", settings), cal.getDescription(), true); spec.addField(MessageManager.getMessage("Embed.Calendar.Link.TimeZone", settings), cal.getTimeZone(), false); spec.setUrl(CalendarMessageFormatter.getCalendarLink(settings.getGuildID())); spec.setFooter(MessageManager.getMessage("Embed.Calendar.Link.CalendarId", "%id%", cal.getId(), settings), null); spec.setColor(GlobalConst.discalColor); }; }
Example #2
Source File: PollManager.java From Shadbot with GNU General Public License v3.0 | 6 votes |
private Mono<Void> show() { final StringBuilder representation = new StringBuilder(); for (int i = 0; i < this.spec.getChoices().size(); i++) { representation.append(String.format("%n\t**%d.** %s", i + 1, this.spec.getChoices().keySet().toArray()[i])); } final Consumer<EmbedCreateSpec> embedConsumer = ShadbotUtils.getDefaultEmbed() .andThen(embed -> embed.setAuthor(String.format("Poll by %s", this.context.getUsername()), null, this.context.getAvatarUrl()) .setDescription(String.format("Vote by clicking on the corresponding number.%n%n__**%s**__%s", this.spec.getQuestion(), representation)) .setFooter(String.format("You have %s to vote. Use %spoll cancel to cancel.", FormatUtils.formatDuration(this.spec.getDuration()), this.context.getPrefix()), "https://i.imgur.com/jcrUDLY.png")); return this.voteMessage.send(embedConsumer) .flatMap(message -> Mono.delay(this.spec.getDuration(), Schedulers.boundedElastic()) .thenReturn(message.getId())) .flatMap(messageId -> this.context.getClient() .getMessageById(this.context.getChannelId(), messageId)) .onErrorResume(ClientException.isStatusCode(HttpResponseStatus.FORBIDDEN.code()), err -> Mono.empty()) .map(Message::getReactions) .flatMap(this::sendResults) .then(); }
Example #3
Source File: JobUser.java From KaellyBot with GNU General Public License v3.0 | 6 votes |
/** * @param users Joueurs de la guilde * @param server Serveur dofus * @param jobs Métiers * @param level Niveau; si ingérieur à 0, filtre ignoré * @return Liste des résultats de la recherche */ public static List<Consumer<EmbedCreateSpec>> getJobsFromFilters(List<Member> users, ServerDofus server, Set<Job> jobs, int level, discord4j.core.object.entity.Guild guild, Language lg){ List<JobUser> result = new ArrayList<>(); for(Member user : users) if (! user.isBot()){ for(Job job : jobs) { List<JobUser> potentials = getJobs().get(user.getId().asLong(), server, job); if (level > 0) { for (JobUser potential : potentials) if (potential.getLevel() >= level) result.add(potential); } else result.addAll(potentials); } } result.sort(JobUser::compare); return getPlayersList(result, guild, server, lg, JOB_PREFIX); }
Example #4
Source File: Monster.java From KaellyBot with GNU General Public License v3.0 | 6 votes |
@Override public void decorateEmbedObject(EmbedCreateSpec spec, Language lg) { spec.setTitle(name) .setUrl(url) .setColor(Color.GRAY) .setThumbnail(skinURL); if (level != null && ! level.isEmpty()) spec.addField(Translator.getLabel(lg, "monster.level"), level, true); spec.addField(Translator.getLabel(lg, "monster.race"), family, true); if (caracteristics != null && ! caracteristics.isEmpty()) spec.addField(Translator.getLabel(lg, "monster.caracteristic"), caracteristics, true); if (resistances != null && ! resistances.isEmpty()) spec.addField(Translator.getLabel(lg, "monster.resistance"), resistances, true); if (error) spec.setFooter(Translator.getLabel(lg, "monster.error"), null); }
Example #5
Source File: CalendarMessageFormatter.java From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 | 6 votes |
public static Consumer<EmbedCreateSpec> getCalendarLinkEmbed(Calendar cal, GuildSettings settings) { return spec -> { Guild guild = DisCalClient.getClient().getGuildById(settings.getGuildID()).block(); if (settings.isBranded() && guild != null) spec.setAuthor(guild.getName(), GlobalConst.discalSite, guild.getIconUrl(Image.Format.PNG).orElse(GlobalConst.iconUrl)); else spec.setAuthor("DisCal", GlobalConst.discalSite, GlobalConst.iconUrl); spec.setTitle(MessageManager.getMessage("Embed.Calendar.Link.Title", settings)); if (cal.getSummary() != null) spec.addField(MessageManager.getMessage("Embed.Calendar.Link.Summary", settings), cal.getSummary(), true); if (cal.getDescription() != null) spec.addField(MessageManager.getMessage("Embed.Calendar.Link.Description", settings), cal.getDescription(), true); spec.addField(MessageManager.getMessage("Embed.Calendar.Link.TimeZone", settings), cal.getTimeZone(), false); spec.setUrl(CalendarMessageFormatter.getCalendarLink(settings.getGuildID())); spec.setFooter(MessageManager.getMessage("Embed.Calendar.Link.CalendarId", "%id%", cal.getId(), settings), null); spec.setColor(GlobalConst.discalColor); }; }
Example #6
Source File: HelpCommand.java From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 | 6 votes |
private Consumer<EmbedCreateSpec> getCommandInfoEmbed(ICommand cmd) { return spec -> { spec.setAuthor("DisCal", GlobalConst.discalSite, GlobalConst.iconUrl); spec.addField("Command", cmd.getCommand(), true); spec.addField("Description", cmd.getCommandInfo().getDescription(), true); spec.addField("Example", cmd.getCommandInfo().getExample(), true); //Loop through sub commands if (cmd.getCommandInfo().getSubCommands().size() > 0) { String subs = cmd.getCommandInfo().getSubCommands().keySet().toString(); subs = subs.replace("[", "").replace("]", ""); spec.addField("Sub-Commands", subs, false); } spec.setFooter("<> = required | () = optional", null); spec.setUrl("https://www.discalbot.com/commands"); spec.setColor(GlobalConst.discalColor); }; }
Example #7
Source File: AudioLoadResultListener.java From Shadbot with GNU General Public License v3.0 | 6 votes |
private Mono<Consumer<EmbedCreateSpec>> getPlaylistEmbed(AudioPlaylist playlist, String avatarUrl) { final String choices = FormatUtils.numberedList(Config.MUSIC_SEARCHES, playlist.getTracks().size(), count -> { final AudioTrackInfo info = playlist.getTracks().get(count - 1).getInfo(); return String.format("\t**%d.** [%s](%s)", count, FormatUtils.trackName(info), info.uri); }); final String playlistName = StringUtils.abbreviate(playlist.getName(), MAX_PLAYLIST_NAME_LENGTH); return DatabaseManager.getGuilds() .getDBGuild(this.guildId) .map(DBGuild::getSettings) .map(Settings::getPrefix) .map(prefix -> ShadbotUtils.getDefaultEmbed() .andThen(embed -> embed.setAuthor(playlistName, null, avatarUrl) .setThumbnail("https://i.imgur.com/IG3Hj2W.png") .setDescription("**Select a music by typing the corresponding number.**" + "\nYou can choose several musics by separating them with a comma." + "\nExample: 1,3,4" + "\n\n" + choices) .setFooter(String.format("Use %scancel to cancel the selection (Automatically " + "canceled in %ds).", prefix, Config.MUSIC_CHOICE_DURATION), null))); }
Example #8
Source File: TriviaCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
@Override public Consumer<EmbedCreateSpec> getHelp(Context context) { return CommandHelpBuilder.create(this, context) .setDescription("Start a Trivia game in which everyone can participate.") .addArg("categoryID", "the category ID of the question", true) .addField("Category", String.format("Use `%s%s categories` to see the list of categories", context.getPrefix(), this.getName()), false) .addField("Gains", String.format("The winner gets **%s** plus a bonus (**%s max.**) depending " + "on his speed to answer.", FormatUtils.coins(Constants.MIN_GAINS), FormatUtils.coins(Constants.MAX_BONUS)), false) .build(); }
Example #9
Source File: HangmanCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
@Override public Consumer<EmbedCreateSpec> getHelp(Context context) { return CommandHelpBuilder.create(this, context) .setDescription("Start a Hangman game.") .addArg("difficulty", String.format("%s. The difficulty of the word to find", FormatUtils.format(Difficulty.class, "/")), true) .addField("Gains", String.format("The winner gets **%s** plus a bonus (**%s max.**) depending " + "on his number of errors. Gains are multiplied depending on the difficulty.", FormatUtils.coins(Constants.MIN_GAINS), FormatUtils.coins(Constants.MAX_BONUS)), false) .build(); }
Example #10
Source File: Resource.java From KaellyBot with GNU General Public License v3.0 | 5 votes |
@Override public void decorateMoreEmbedObject(EmbedCreateSpec spec, Language lg) { spec.setTitle(name) .setUrl(url); if (description != null && ! description.isEmpty()) spec.setDescription(description); spec.setColor(Color.GRAY) .setImage(skinURL); if (level != null && ! level.isEmpty()) spec.addField(Translator.getLabel(lg, "resource.niveau"), level, true); spec.addField(Translator.getLabel(lg, "resource.type"), type, true); if (effects != null && ! effects.isEmpty()) spec.addField(Translator.getLabel(lg, "resource.effets"), effects, true); if (bonus != null && ! bonus.isEmpty()) spec.addField(Translator.getLabel(lg, "resource.bonus"), bonus, true); if (sorts != null && ! sorts.isEmpty()) spec.addField(Translator.getLabel(lg, "resource.sorts"),sorts, true); if (recipe != null) spec.addField(Translator.getLabel(lg, "resource.recette"), recipe, true); if (! monsterDrop.isEmpty()) for(int i = 0; i < monsterDrop.size(); i++) spec.addField(Translator.getLabel(lg, "resource.monster") + (monsterDrop.size() > 1? " (" + (i + 1) + "/" + monsterDrop.size() + ")" : "") + " : ", monsterDrop.get(i), true); }
Example #11
Source File: Almanax.java From KaellyBot with GNU General Public License v3.0 | 5 votes |
@Override public void decorateMoreEmbedObject(EmbedCreateSpec spec, Language lg) { spec.setTitle(Translator.getLabel(lg, "almanax.embed.title.1") + " " + day) .setUrl(Translator.getLabel(lg, "almanax.url") + day) .setDescription(quest) .setColor(Color.GRAY) .setImage(ressourceURL) .addField(Translator.getLabel(lg, "almanax.embed.bonus"), bonus, true) .addField(Translator.getLabel(lg, "almanax.embed.offrande"), offrande, true); }
Example #12
Source File: BlacklistSettingCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
@Override public Consumer<EmbedCreateSpec> getHelp(Context context) { return SettingHelpBuilder.create(this, context) .addArg("action", FormatUtils.format(Action.class, "/"), false) .addArg("type", FormatUtils.format(Type.class, "/"), false) .addArg("name(s)", "command/category name", false) .setExample(String.format("`%s%s add command rule34 russian_roulette`" + "%n`%s%s add category NSFW`", context.getPrefix(), this.getCommandName(), context.getPrefix(), this.getCommandName())) .build(); }
Example #13
Source File: SetDofus.java From KaellyBot with GNU General Public License v3.0 | 5 votes |
@Override public void decorateMoreEmbedObject(EmbedCreateSpec spec, Language lg) { spec.setTitle(name) .setUrl(url) .setColor(Color.GRAY) .setImage(skinURL); if (level != null && ! level.isEmpty()) spec.addField(Translator.getLabel(lg, "set.level"), level, true); if (composition != null && ! composition.isEmpty()) spec.addField(Translator.getLabel(lg, "set.composition"), composition, true); if (bonusTotal != null && ! bonusTotal.isEmpty()) for(int i = 0; i < bonusTotal.size(); i++) spec.addField(Translator.getLabel(lg, "set.bonus.total") + (bonusTotal.size() > 1? " (" + (i + 1) + "/" + bonusTotal.size() + ")" : "") + " : ", bonusTotal.get(i), true); if (! recipeTotal.isEmpty()) for(int i = 0; i < recipeTotal.size(); i++) spec.addField(Translator.getLabel(lg, "set.recipe") + (recipeTotal.size() > 1? " (" + (i + 1) + "/" + recipeTotal.size() + ")" : "") + " : ", recipeTotal.get(i), true); for(int i = 0; i < bonusPano.length; i++) spec.addField(Translator.getLabel(lg, "set.bonus.1") + " " + (i + 2) + " " + Translator.getLabel(lg, "set.bonus.2"), bonusPano[i], true); }
Example #14
Source File: SuicideGirlsCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
@Override public Consumer<EmbedCreateSpec> getHelp(Context context) { return CommandHelpBuilder.create(this, context) .setDescription("Show a random Suicide Girl image.") .setSource("https://www.suicidegirls.com/") .build(); }
Example #15
Source File: UserInfoCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
private Consumer<EmbedCreateSpec> getEmbed(Member member, List<Role> roles, String avatarUrl) { final LocalDateTime createTime = TimeUtils.toLocalDateTime(member.getId().getTimestamp()); final String creationDate = String.format("%s%n(%s)", createTime.format(this.dateFormatter), FormatUtils.formatLongDuration(createTime)); final LocalDateTime joinTime = TimeUtils.toLocalDateTime(member.getJoinTime()); final String joinDate = String.format("%s%n(%s)", joinTime.format(this.dateFormatter), FormatUtils.formatLongDuration(joinTime)); final StringBuilder usernameBuilder = new StringBuilder(member.getUsername()); if (member.isBot()) { usernameBuilder.append(" (Bot)"); } if (member.getPremiumTime().isPresent()) { usernameBuilder.append(" (Booster)"); } return ShadbotUtils.getDefaultEmbed() .andThen(embed -> { embed.setAuthor(String.format("User Info: %s", usernameBuilder), null, avatarUrl) .setThumbnail(member.getAvatarUrl()) .addField("Display name", member.getDisplayName(), false) .addField("User ID", member.getId().asString(), false) .addField("Creation date", creationDate, false) .addField("Join date", joinDate, false); if (!roles.isEmpty()) { embed.addField("Roles", FormatUtils.format(roles, Role::getMention, "\n"), true); } }); }
Example #16
Source File: CalendarMessageFormatter.java From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 | 5 votes |
/** * Creates an EmbedObject for the PreCalendar. * * @param calendar The PreCalendar to create an EmbedObject for. * @return The EmbedObject for the PreCalendar. */ public static Consumer<EmbedCreateSpec> getPreCalendarEmbed(PreCalendar calendar, GuildSettings settings) { return spec -> { Guild guild = DisCalClient.getClient().getGuildById(settings.getGuildID()).block(); if (settings.isBranded() && guild != null) spec.setAuthor(guild.getName(), GlobalConst.discalSite, guild.getIconUrl(Image.Format.PNG).orElse(GlobalConst.iconUrl)); else spec.setAuthor("DisCal", GlobalConst.discalSite, GlobalConst.iconUrl); spec.setTitle(MessageManager.getMessage("Embed.Calendar.Pre.Title", settings)); if (calendar.getSummary() != null) spec.addField(MessageManager.getMessage("Embed.Calendar.Pre.Summary", settings), calendar.getSummary(), true); else spec.addField(MessageManager.getMessage("Embed.Calendar.Pre.Summary", settings), "***UNSET***", true); if (calendar.getDescription() != null) spec.addField(MessageManager.getMessage("Embed.Calendar.Pre.Description", settings), calendar.getDescription(), false); else spec.addField(MessageManager.getMessage("Embed.Calendar.Pre.Description", settings), "***UNSET***", false); if (calendar.getTimezone() != null) spec.addField(MessageManager.getMessage("Embed.Calendar.Pre.TimeZone", settings), calendar.getTimezone(), true); else spec.addField(MessageManager.getMessage("Embed.Calendar.Pre.TimeZone", settings), "***UNSET***", true); if (calendar.isEditing()) spec.addField(MessageManager.getMessage("Embed.Calendar.Pre.CalendarId", settings), calendar.getCalendarId(), false); spec.setFooter(MessageManager.getMessage("Embed.Calendar.Pre.Key", settings), null); spec.setColor(GlobalConst.discalColor); }; }
Example #17
Source File: DisCalCommand.java From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 | 5 votes |
private void moduleSettings(MessageCreateEvent event, GuildSettings settings) { Consumer<EmbedCreateSpec> embed = spec -> { Guild guild = event.getGuild().block(); if (settings.isBranded() && guild != null) spec.setAuthor(guild.getName(), GlobalConst.discalSite, guild.getIconUrl(Image.Format.PNG).orElse(GlobalConst.iconUrl)); else spec.setAuthor("DisCal", GlobalConst.discalSite, GlobalConst.iconUrl); spec.setTitle(MessageManager.getMessage("Embed.DisCal.Settings.Title", settings)); spec.addField(MessageManager.getMessage("Embed.DisCal.Settings.ExternalCal", settings), String.valueOf(settings.useExternalCalendar()), true); if (RoleUtils.roleExists(settings.getControlRole(), event)) { spec.addField(MessageManager.getMessage("Embed.Discal.Settings.Role", settings), RoleUtils.getRoleNameFromID(settings.getControlRole(), event), true); } else { spec.addField(MessageManager.getMessage("Embed.Discal.Settings.Role", settings), "everyone", true); } if (ChannelUtils.channelExists(settings.getDiscalChannel(), event)) { spec.addField(MessageManager.getMessage("Embed.DisCal.Settings.Channel", settings), ChannelUtils.getChannelNameFromNameOrId(settings.getDiscalChannel(), guild), false); } else { spec.addField(MessageManager.getMessage("Embed.DisCal.Settings.Channel", settings), "All Channels", true); } spec.addField(MessageManager.getMessage("Embed.DisCal.Settings.SimpleAnn", settings), String.valueOf(settings.usingSimpleAnnouncements()), true); spec.addField(MessageManager.getMessage("Embed.DisCal.Settings.Patron", settings), String.valueOf(settings.isPatronGuild()), true); spec.addField(MessageManager.getMessage("Embed.DisCal.Settings.Dev", settings), String.valueOf(settings.isDevGuild()), true); spec.addField(MessageManager.getMessage("Embed.DisCal.Settings.MaxCal", settings), String.valueOf(settings.getMaxCalendars()), true); spec.addField(MessageManager.getMessage("Embed.DisCal.Settings.Language", settings), settings.getLang(), true); spec.addField(MessageManager.getMessage("Embed.DisCal.Settings.Prefix", settings), settings.getPrefix(), true); //TODO: Add translations... spec.addField("Using Branding", settings.isBranded() + "", true); spec.setFooter(MessageManager.getMessage("Embed.DisCal.Info.Patron", settings) + ": https://www.patreon.com/Novafox", null); spec.setUrl("https://www.discalbot.com/"); spec.setColor(GlobalConst.discalColor); }; MessageManager.sendMessageAsync(embed, event); }
Example #18
Source File: WikiCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
@Override public Consumer<EmbedCreateSpec> getHelp(Context context) { return CommandHelpBuilder.create(this, context) .setDescription("Show Wikipedia description for a search.") .addArg("search", false) .setSource("https://www.wikipedia.org/") .build(); }
Example #19
Source File: RouletteCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
@Override public Consumer<EmbedCreateSpec> getHelp(Context context) { return CommandHelpBuilder.create(this, context) .setDescription("Play a roulette game in which everyone can participate.") .addArg("bet", false) .addArg("place", String.format("number between 1 and 36, %s", FormatUtils.format(Place.class, ", ")), false) .addField("Info", "**low** - numbers between 1 and 18" + "\n**high** - numbers between 19 and 36", false) .addField("Gains", "The game follows the same rules and winnings as real Roulette.", false) .build(); }
Example #20
Source File: Almanax.java From KaellyBot with GNU General Public License v3.0 | 5 votes |
@Override public void decorateEmbedObject(EmbedCreateSpec spec, Language lg) { spec.setTitle(Translator.getLabel(lg, "almanax.embed.title.1") + " " + day) .setUrl(Translator.getLabel(lg, "almanax.url") + day) .setColor(Color.GRAY) .setThumbnail(ressourceURL) .addField(Translator.getLabel(lg, "almanax.embed.bonus"), bonus, true) .addField(Translator.getLabel(lg, "almanax.embed.offrande"), offrande, true); }
Example #21
Source File: RussianRouletteCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
@Override public Consumer<EmbedCreateSpec> getHelp(Context context) { return CommandHelpBuilder.create(this, context) .setDescription("Play russian roulette.") .addField("Rules", String.format("You initially have 1/6 chance of dying and, the more you win, " + "the more you are likely to lose. " + "%nOnce dead, you will not be able to play for %d hours.", Constants.RESET_HOURS), false) .addField("Cost", String.format("A game costs **%s**.", FormatUtils.coins(Constants.PAID_COST)), false) .addField("Gains", String.format("Each time you win, you randomly get between **%s** and **%s** multiplied" + " by your number of tries.", FormatUtils.coins(Constants.MIN_GAINS), FormatUtils.coins(Constants.MAX_GAINS)), false) .build(); }
Example #22
Source File: PruneCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
@Override public Consumer<EmbedCreateSpec> getHelp(Context context) { return CommandHelpBuilder.create(this, context) .setDescription("Delete messages (include embeds).") .addArg("@user(s)", "from these users", true) .addArg("\"words\"", "containing these words", true) .addArg("number", String.format("number of messages to delete (max: %d)", MAX_MESSAGES), true) .setExample(String.format("Delete **15** messages from user **@Shadbot** containing **hi guys**:" + "%n`%s%s @Shadbot \"hi guys\" 15`", context.getPrefix(), this.getName())) .addField("Info", "Messages older than 2 weeks cannot be deleted.", false) .build(); }
Example #23
Source File: ForwardCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
@Override public Consumer<EmbedCreateSpec> getHelp(Context context) { return CommandHelpBuilder.create(this, context) .setDescription("Fast forward current song a specified amount of time.") .addArg("time", "can be seconds or time (e.g. 72 or 1m12s)", false) .build(); }
Example #24
Source File: CoinsCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
@Override public Consumer<EmbedCreateSpec> getHelp(Context context) { return CommandHelpBuilder.create(this, context) .setDescription("Show how many coins a user has.") .addArg("@user", "if not specified, it will show your coins", true) .build(); }
Example #25
Source File: TransferCoinsCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
@Override public Consumer<EmbedCreateSpec> getHelp(Context context) { return CommandHelpBuilder.create(this, context) .setDescription("Transfer coins to a user.") .addArg("coins", false) .addArg("@user", false) .build(); }
Example #26
Source File: EventMessageFormatter.java From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 | 5 votes |
/** * Gets an EmbedObject for the specified CreatorResponse. * * @param ecr The CreatorResponse involved. * @return The EmbedObject for the CreatorResponse. */ public static Consumer<EmbedCreateSpec> getEventConfirmationEmbed(EventCreatorResponse ecr, GuildSettings settings) { return spec -> { EventData ed = DatabaseManager.getManager().getEventData(settings.getGuildID(), ecr.getEvent().getId()); Guild guild = DisCalClient.getClient().getGuildById(settings.getGuildID()).block(); if (settings.isBranded() && guild != null) spec.setAuthor(guild.getName(), GlobalConst.discalSite, guild.getIconUrl(Image.Format.PNG).orElse(GlobalConst.iconUrl)); else spec.setAuthor("DisCal", GlobalConst.discalSite, GlobalConst.iconUrl); spec.setTitle(MessageManager.getMessage("Embed.Event.Confirm.Title", settings)); if (ed.getImageLink() != null && ImageUtils.validate(ed.getImageLink(), settings.isPatronGuild())) { spec.setImage(ed.getImageLink()); } spec.addField(MessageManager.getMessage("Embed.Event.Confirm.ID", settings), ecr.getEvent().getId(), false); spec.addField(MessageManager.getMessage("Embed.Event.Confirm.Date", settings), getHumanReadableDate(ecr.getEvent().getStart(), settings, false), false); if (ecr.getEvent().getLocation() != null && !ecr.getEvent().getLocation().equalsIgnoreCase("")) { if (ecr.getEvent().getLocation().length() > 300) { String location = ecr.getEvent().getLocation().substring(0, 300).trim() + "... (cont. on Google Cal)"; spec.addField(MessageManager.getMessage("Embed.Event.Confirm.Location", settings), location, true); } else { spec.addField(MessageManager.getMessage("Embed.Event.Confirm.Location", settings), ecr.getEvent().getLocation(), true); } } spec.setFooter(MessageManager.getMessage("Embed.Event.Confirm.Footer", settings), null); spec.setUrl(ecr.getEvent().getHtmlLink()); try { EventColor ec = EventColor.fromId(Integer.valueOf(ecr.getEvent().getColorId())); spec.setColor(ec.asColor()); } catch (Exception e) { //Color is null, ignore and add our default. spec.setColor(GlobalConst.discalColor); } }; }
Example #27
Source File: PlayCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
@Override public Consumer<EmbedCreateSpec> getHelp(Context context) { return CommandHelpBuilder.create(this, context) .setDescription("Play the music(s) from the url, search terms or playlist.") .setFullUsage(String.format("%s%s[first] [soundcloud] <url>", context.getPrefix(), this.getName())) .addArg("first", "add the song at the top of the playlist", true) .addArg("soundcloud", "search on SoundCloud instead of YouTube", true) .setExample(String.format("`%splayfirst soundcloud At Doom's gate`" + "%n`%splay E1M8`", context.getPrefix(), context.getPrefix())) .build(); }
Example #28
Source File: CounterStrikeCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
@Override public Consumer<EmbedCreateSpec> getHelp(Context context) { return CommandHelpBuilder.create(this, context) .setDescription("Show player's stats for Counter-Strike: Global Offensive.") .addArg("steamID", "steam ID, custom ID or profile URL", false) .setExample(String.format("%s%s shadorc", context.getPrefix(), this.getName())) .build(); }
Example #29
Source File: GenerateRelicCmd.java From Shadbot with GNU General Public License v3.0 | 5 votes |
@Override public Consumer<EmbedCreateSpec> getHelp(Context context) { return CommandHelpBuilder.create(this, context) .setDescription("Generate a relic.") .addArg("type", FormatUtils.format(RelicType.class, "/"), false) .build(); }
Example #30
Source File: Monster.java From KaellyBot with GNU General Public License v3.0 | 5 votes |
@Override public void decorateMoreEmbedObject(EmbedCreateSpec spec, Language lg) { spec.setTitle(name) .setUrl(url) .setColor(Color.GRAY) .setImage(skinURL); if (level != null && ! level.isEmpty()) spec.addField(Translator.getLabel(lg, "monster.level"), level, true); spec.addField(Translator.getLabel(lg, "monster.race"), family, true); if (caracteristics != null && ! caracteristics.isEmpty()) spec.addField(Translator.getLabel(lg, "monster.caracteristic"), caracteristics, true); if (resistances != null && ! resistances.isEmpty()) spec.addField(Translator.getLabel(lg, "monster.resistance"), resistances, true); if (zones != null && ! zones.isEmpty()) spec.addField(Translator.getLabel(lg, "monster.zones"), zones, true); if (! butins.isEmpty()) for(int i = 0; i < butins.size(); i++) spec.addField(Translator.getLabel(lg, "monster.butins") + (butins.size() > 1? " (" + (i + 1) + "/" + butins.size() + ")" : "") + " : ", butins.get(i), true); if (! butinsConditionne.isEmpty()) for(int i = 0; i < butinsConditionne.size(); i++) spec.addField(Translator.getLabel(lg, "monster.butins_conditionnes") + (butinsConditionne.size() > 1? " (" + (i + 1) + "/" + butinsConditionne.size() + ")" : "") + " : ", butinsConditionne.get(i), true); if (error) spec.setFooter(Translator.getLabel(lg, "monster.error"), null); }