From 9f29002b99a69ef9018b7a2fbd2bc7255d7d436d Mon Sep 17 00:00:00 2001 From: NovaFox161 Date: Sun, 27 May 2018 17:32:46 -0500 Subject: [PATCH] Make the event color list look much better --- .../bot/module/command/EventCommand.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Bot/src/main/java/com/cloudcraftgaming/discal/bot/module/command/EventCommand.java b/Bot/src/main/java/com/cloudcraftgaming/discal/bot/module/command/EventCommand.java index ba707f8e..bf79bb6c 100644 --- a/Bot/src/main/java/com/cloudcraftgaming/discal/bot/module/command/EventCommand.java +++ b/Bot/src/main/java/com/cloudcraftgaming/discal/bot/module/command/EventCommand.java @@ -1,5 +1,6 @@ package com.cloudcraftgaming.discal.bot.module.command; +import com.cloudcraftgaming.discal.api.DisCalAPI; import com.cloudcraftgaming.discal.api.calendar.CalendarAuth; import com.cloudcraftgaming.discal.api.database.DatabaseManager; import com.cloudcraftgaming.discal.api.enums.event.EventColor; @@ -20,6 +21,7 @@ import com.google.api.services.calendar.model.Event; import com.google.api.services.calendar.model.EventDateTime; import sx.blah.discord.handle.impl.events.guild.channel.message.MessageReceivedEvent; import sx.blah.discord.handle.obj.IMessage; +import sx.blah.discord.util.EmbedBuilder; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -749,19 +751,25 @@ public class EventCommand implements ICommand { if (args.length == 2) { String value = args[1]; if (value.equalsIgnoreCase("list") || value.equalsIgnoreCase("colors") || value.equalsIgnoreCase("colours")) { - //TODO: Make this list pretty!!! - StringBuilder list = new StringBuilder("All Colors: "); + EmbedBuilder em = new EmbedBuilder(); + em.withAuthorIcon(DisCalAPI.getAPI().getClient().getGuildByID(266063520112574464L).getIconURL()); + em.withAuthorName("DisCal!"); + + em.withTitle("Available Colors"); + em.withUrl("https://discalbot.com/docs/event/colors"); + em.withColor(56, 138, 237); + em.withFooterText("Click Title for previews of the colors!"); + for (EventColor ec : EventColor.values()) { - list.append(MessageUtils.lineBreak).append("Name: ").append(ec.name()).append(", ID: ").append(ec.getId()); + em.appendField(ec.name(), ec.getId() + "", true); } - list.append(MessageUtils.lineBreak).append(MessageUtils.lineBreak).append(MessageManager.getMessage("Creator.Event.Color.List", settings)); if (EventCreator.getCreator().hasCreatorMessage(guildId)) { Message.deleteMessage(event); Message.deleteMessage(EventCreator.getCreator().getCreatorMessage(guildId)); - EventCreator.getCreator().setCreatorMessage(Message.sendMessage(EventMessageFormatter.getPreEventEmbed(EventCreator.getCreator().getPreEvent(guildId), settings), list.toString().trim(), event)); + EventCreator.getCreator().setCreatorMessage(Message.sendMessage(em.build(), "All Supported Colors. Use either the name or ID in the command: `!event color `", event)); } else { - Message.sendMessage(list.toString().trim(), event); + Message.sendMessage(em.build(), "All Supported Colors. Use either the name or ID in the command: `!event color `", event); } } else { if (EventCreator.getCreator().hasPreEvent(guildId)) {