Search in sources :

Example 16 with CommandRegistry

use of net.kodehawa.mantarobot.core.CommandRegistry in project MantaroBot by Mantaro.

the class PlayerCmds method profile.

@Subscribe
public void profile(CommandRegistry cr) {
    ITreeCommand profileCommand = (TreeCommand) cr.register("profile", new TreeCommand(Category.CURRENCY) {

        @Override
        public Command defaultTrigger(GuildMessageReceivedEvent event, String mainCommand, String commandName) {
            return new SubCommand() {

                @Override
                protected void call(GuildMessageReceivedEvent event, String content) {
                    User userLooked = event.getAuthor();
                    Player player = MantaroData.db().getPlayer(userLooked);
                    UserData user = MantaroData.db().getUser(event.getMember()).getData();
                    Member memberLooked = event.getMember();
                    List<Member> found = FinderUtil.findMembers(content, event.getGuild());
                    if (found.isEmpty() && !content.isEmpty()) {
                        event.getChannel().sendMessage(EmoteReference.ERROR + "Didn't find any member with your search criteria :(").queue();
                        return;
                    }
                    if (found.size() > 1 && !content.isEmpty()) {
                        event.getChannel().sendMessage(EmoteReference.THINKING + "Too many members found, maybe refine your search? (ex. use name#discriminator)\n" + "**Members found:** " + found.stream().map(m -> m.getUser().getName() + "#" + m.getUser().getDiscriminator()).collect(Collectors.joining(", "))).queue();
                        return;
                    }
                    if (found.size() == 1 && !content.isEmpty()) {
                        userLooked = found.get(0).getUser();
                        memberLooked = found.get(0);
                        if (userLooked.isBot()) {
                            event.getChannel().sendMessage(EmoteReference.ERROR + "Bots don't have profiles.").queue();
                            return;
                        }
                        user = MantaroData.db().getUser(userLooked).getData();
                        player = MantaroData.db().getPlayer(memberLooked);
                    }
                    User marriedTo = (player.getData().getMarriedWith() == null || player.getData().getMarriedWith().isEmpty()) ? null : MantaroBot.getInstance().getUserById(player.getData().getMarriedWith());
                    PlayerData playerData = player.getData();
                    Inventory inv = player.getInventory();
                    // start of badge assigning
                    Guild mh = MantaroBot.getInstance().getGuildById("213468583252983809");
                    Member mhMember = mh == null ? null : mh.getMemberById(memberLooked.getUser().getId());
                    boolean saveAfter = false;
                    if (player.getMoney() > 7526527671L && playerData.addBadgeIfAbsent(Badge.ALTERNATIVE_WORLD))
                        saveAfter = true;
                    if (MantaroData.config().get().isOwner(userLooked) && playerData.addBadgeIfAbsent(Badge.DEVELOPER))
                        saveAfter = true;
                    if (inv.asList().stream().anyMatch(stack -> stack.getAmount() == 5000) && playerData.addBadgeIfAbsent(Badge.SHOPPER))
                        saveAfter = true;
                    if (inv.asList().stream().anyMatch(stack -> stack.getItem().equals(Items.CHRISTMAS_TREE_SPECIAL) || stack.getItem().equals(Items.BELL_SPECIAL)) && playerData.addBadgeIfAbsent(Badge.CHRISTMAS))
                        saveAfter = true;
                    if (MantaroBot.getInstance().getShardedMantaro().getDiscordBotsUpvoters().contains(userLooked.getIdLong()) && playerData.addBadgeIfAbsent(Badge.UPVOTER))
                        saveAfter = true;
                    if (player.getLevel() >= 10 && playerData.addBadgeIfAbsent(Badge.WALKER))
                        saveAfter = true;
                    if (player.getLevel() >= 50 && playerData.addBadgeIfAbsent(Badge.RUNNER))
                        saveAfter = true;
                    if (player.getLevel() >= 100 && playerData.addBadgeIfAbsent(Badge.FAST_RUNNER))
                        saveAfter = true;
                    if (player.getLevel() >= 150 && playerData.addBadgeIfAbsent(Badge.MARATHON_RUNNER))
                        saveAfter = true;
                    if (player.getLevel() >= 200 && playerData.addBadgeIfAbsent(Badge.MARATHON_WINNER))
                        saveAfter = true;
                    if (playerData.getMarketUsed() > 1000 && playerData.addBadgeIfAbsent(Badge.COMPULSIVE_BUYER))
                        saveAfter = true;
                    if (mhMember != null && mhMember.getRoles().stream().anyMatch(r -> r.getIdLong() == 406920476259123201L) && playerData.addBadgeIfAbsent(Badge.HELPER_2))
                        saveAfter = true;
                    if (mhMember != null && mhMember.getRoles().stream().anyMatch(r -> r.getIdLong() == 290257037072531466L || r.getIdLong() == 290902183300431872L) && playerData.addBadgeIfAbsent(Badge.DONATOR_2))
                        saveAfter = true;
                    if (saveAfter)
                        player.saveAsync();
                    // end of badge assigning
                    List<Badge> badges = playerData.getBadges();
                    Collections.sort(badges);
                    String displayBadges = badges.stream().map(Badge::getUnicode).limit(5).collect(Collectors.joining("  "));
                    applyBadge(event.getChannel(), badges.isEmpty() ? null : (playerData.getMainBadge() == null ? badges.get(0) : playerData.getMainBadge()), userLooked, baseEmbed(event, (marriedTo == null || !player.getInventory().containsItem(Items.RING) ? "" : EmoteReference.RING) + memberLooked.getEffectiveName() + "'s Profile", userLooked.getEffectiveAvatarUrl()).setThumbnail(userLooked.getEffectiveAvatarUrl()).setDescription((player.getData().isShowBadge() ? (badges.isEmpty() ? "" : String.format("**%s**\n", (playerData.getMainBadge() == null ? badges.get(0) : playerData.getMainBadge()))) : "") + (player.getData().getDescription() == null ? "No description set" : player.getData().getDescription())).addField(EmoteReference.DOLLAR + "Credits", "$ " + player.getMoney(), true).addField(EmoteReference.ZAP + "Level", player.getLevel() + " (Experience: " + player.getData().getExperience() + ")", true).addField(EmoteReference.REP + "Reputation", String.valueOf(player.getReputation()), true).addField(EmoteReference.POPPER + "Birthday", user.getBirthday() != null ? user.getBirthday().substring(0, 5) : "Not specified.", true).addField(EmoteReference.HEART + "Married with", marriedTo == null ? "Nobody." : marriedTo.getName() + "#" + marriedTo.getDiscriminator(), false).addField(EmoteReference.POUCH + "Inventory", ItemStack.toString(inv.asList()), false).addField(EmoteReference.HEART + "Top 5 Badges", displayBadges.isEmpty() ? "No badges (yet!)" : displayBadges, false).setFooter("User's timezone: " + (user.getTimezone() == null ? "No timezone set." : user.getTimezone()) + " | " + "Requested by " + event.getAuthor().getName(), null));
                }
            };
        }

        @Override
        public MessageEmbed help(GuildMessageReceivedEvent event) {
            return helpEmbed(event, "Profile command.").setDescription("**Retrieves your current user profile.**").addField("Usage", "- To retrieve your profile, `~>profile`\n" + "- To change your description do `~>profile description set <description>`\n" + "  -- To clear it, just do `~>profile description clear`\n" + "- To set your timezone do `~>profile timezone <timezone>`\n" + "- To set your display badge use `~>profile displaybadge` and `~>profile displaybadge reset` to reset it.\n" + "  -- You can also use `~>profile displaybadge none` to display no badge on your profile.\n" + "**The profile only shows the 5 most important badges!.** Use `~>badges` to get a complete list.", false).build();
        }
    });
    profileCommand.addSubCommand("timezone", new SubCommand() {

        @Override
        protected void call(GuildMessageReceivedEvent event, String content) {
            DBUser dbUser = MantaroData.db().getUser(event.getAuthor());
            String[] args = content.split(" ");
            if (args.length < 1) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "You need to specify the timezone.").queue();
                return;
            }
            String timezone = args[0];
            if (timezone.equalsIgnoreCase("reset")) {
                dbUser.getData().setTimezone(null);
                dbUser.saveAsync();
                event.getChannel().sendMessage(EmoteReference.CORRECT + "Reset timezone.").queue();
                return;
            }
            if (!Utils.isValidTimeZone(timezone)) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "Invalid timezone.").queue();
                return;
            }
            try {
                UtilsCmds.dateGMT(event.getGuild(), timezone);
            } catch (Exception e) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "Not a valid timezone.").queue();
                return;
            }
            dbUser.getData().setTimezone(timezone);
            dbUser.saveAsync();
            event.getChannel().sendMessage(String.format("%sSaved timezone, your profile timezone is now: **%s**", EmoteReference.CORRECT, timezone)).queue();
        }
    });
    profileCommand.addSubCommand("description", new SubCommand() {

        @Override
        protected void call(GuildMessageReceivedEvent event, String content) {
            String[] args = content.split(" ");
            User author = event.getAuthor();
            Player player = MantaroData.db().getPlayer(author);
            if (args.length == 0) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "You need to provide an argument! (set or remove)\n" + "for example, ~>profile description set Hi there!").queue();
                return;
            }
            if (args[0].equals("set")) {
                int MAX_LENGTH = 300;
                if (MantaroData.db().getUser(author).isPremium())
                    MAX_LENGTH = 500;
                String content1 = SPLIT_PATTERN.split(content, 2)[1];
                if (content1.length() > MAX_LENGTH) {
                    event.getChannel().sendMessage(EmoteReference.ERROR + "The description is too long! `(Limit of 300 characters for everyone and 500 for premium users)`").queue();
                    return;
                }
                player.getData().setDescription(content1);
                event.getChannel().sendMessage(EmoteReference.POPPER + "Set description to: **" + content1 + "**\n" + "Check your shiny new profile with `~>profile`").queue();
                player.save();
                return;
            }
            if (args[1].equals("clear")) {
                player.getData().setDescription(null);
                event.getChannel().sendMessage(EmoteReference.CORRECT + "Successfully cleared description.").queue();
                player.save();
            }
        }
    });
    profileCommand.addSubCommand("displaybadge", new SubCommand() {

        @Override
        protected void call(GuildMessageReceivedEvent event, String content) {
            String[] args = content.split(" ");
            if (args.length == 0) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "You need to specify your main badge!").queue();
                return;
            }
            Player player = MantaroData.db().getPlayer(event.getAuthor());
            PlayerData data = player.getData();
            if (args[0].equalsIgnoreCase("none")) {
                data.setShowBadge(false);
                event.getChannel().sendMessage(EmoteReference.CORRECT + "No badge will show on the top of your profile now!").queue();
                player.saveAsync();
                return;
            }
            if (args[0].equalsIgnoreCase("reset")) {
                data.setMainBadge(null);
                data.setShowBadge(true);
                event.getChannel().sendMessage(EmoteReference.CORRECT + "Your display badge is now the most important one.").queue();
                player.saveAsync();
                return;
            }
            Badge badge = Badge.lookupFromString(content);
            if (badge == null) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "There's no such badge...\n" + "Your available badges: " + player.getData().getBadges().stream().map(Badge::getDisplay).collect(Collectors.joining(", "))).queue();
                return;
            }
            if (!data.getBadges().contains(badge)) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "You don't have that badge.\n" + "Your available badges: " + player.getData().getBadges().stream().map(Badge::getDisplay).collect(Collectors.joining(", "))).queue();
                return;
            }
            data.setShowBadge(true);
            data.setMainBadge(badge);
            player.saveAsync();
            event.getChannel().sendMessage(EmoteReference.CORRECT + "Your display badge is now: **" + badge.display + "**").queue();
        }
    });
}
Also used : Items(net.kodehawa.mantarobot.commands.currency.item.Items) Badge(net.kodehawa.mantarobot.commands.currency.profile.Badge) MantaroInfo(net.kodehawa.mantarobot.MantaroInfo) Module(net.kodehawa.mantarobot.core.modules.Module) java.util(java.util) Command(net.kodehawa.mantarobot.core.modules.commands.base.Command) PlayerData(net.kodehawa.mantarobot.db.entities.helpers.PlayerData) Utils(net.kodehawa.mantarobot.utils.Utils) RateLimiter(net.kodehawa.mantarobot.utils.commands.RateLimiter) DiscordUtils(net.kodehawa.mantarobot.utils.DiscordUtils) MantaroBot(net.kodehawa.mantarobot.MantaroBot) MessageBuilder(net.dv8tion.jda.core.MessageBuilder) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) ITreeCommand(net.kodehawa.mantarobot.core.modules.commands.base.ITreeCommand) CommandRegistry(net.kodehawa.mantarobot.core.CommandRegistry) Utils.handleDefaultRatelimit(net.kodehawa.mantarobot.utils.Utils.handleDefaultRatelimit) DBUser(net.kodehawa.mantarobot.db.entities.DBUser) Inventory(net.kodehawa.mantarobot.db.entities.helpers.Inventory) Response(okhttp3.Response) StringUtils(br.com.brjdevs.java.utils.texts.StringUtils) Subscribe(com.google.common.eventbus.Subscribe) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) ItemStack(net.kodehawa.mantarobot.commands.currency.item.ItemStack) ResponseBody(okhttp3.ResponseBody) Player(net.kodehawa.mantarobot.db.entities.Player) SubCommand(net.kodehawa.mantarobot.core.modules.commands.SubCommand) Request(okhttp3.Request) UserData(net.kodehawa.mantarobot.db.entities.helpers.UserData) net.dv8tion.jda.core.entities(net.dv8tion.jda.core.entities) Category(net.kodehawa.mantarobot.core.modules.commands.base.Category) SPLIT_PATTERN(net.kodehawa.mantarobot.utils.StringUtils.SPLIT_PATTERN) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) TreeCommand(net.kodehawa.mantarobot.core.modules.commands.TreeCommand) java.awt(java.awt) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) OkHttpClient(okhttp3.OkHttpClient) EmoteReference(net.kodehawa.mantarobot.utils.commands.EmoteReference) MantaroData(net.kodehawa.mantarobot.data.MantaroData) FinderUtil(com.jagrosh.jdautilities.utils.FinderUtil) Player(net.kodehawa.mantarobot.db.entities.Player) SubCommand(net.kodehawa.mantarobot.core.modules.commands.SubCommand) DBUser(net.kodehawa.mantarobot.db.entities.DBUser) UserData(net.kodehawa.mantarobot.db.entities.helpers.UserData) Badge(net.kodehawa.mantarobot.commands.currency.profile.Badge) IOException(java.io.IOException) ITreeCommand(net.kodehawa.mantarobot.core.modules.commands.base.ITreeCommand) DBUser(net.kodehawa.mantarobot.db.entities.DBUser) PlayerData(net.kodehawa.mantarobot.db.entities.helpers.PlayerData) ITreeCommand(net.kodehawa.mantarobot.core.modules.commands.base.ITreeCommand) TreeCommand(net.kodehawa.mantarobot.core.modules.commands.TreeCommand) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) Inventory(net.kodehawa.mantarobot.db.entities.helpers.Inventory) Subscribe(com.google.common.eventbus.Subscribe)

Example 17 with CommandRegistry

use of net.kodehawa.mantarobot.core.CommandRegistry in project MantaroBot by Mantaro.

the class CurrencyCmds method inventory.

@Subscribe
public void inventory(CommandRegistry cr) {
    cr.register("inventory", new SimpleCommand(Category.CURRENCY) {

        @Override
        public void call(GuildMessageReceivedEvent event, String content, String[] args) {
            Map<String, Optional<String>> t = StringUtils.parse(args);
            content = Utils.replaceArguments(t, content, "brief", "calculate");
            Member member = Utils.findMember(event, event.getMember(), content);
            if (member == null)
                return;
            Player player = MantaroData.db().getPlayer(member);
            if (t.containsKey("brief")) {
                event.getChannel().sendMessage(String.format("**%s's inventory:** %s", member.getEffectiveName(), ItemStack.toString(player.getInventory().asList()))).queue();
                return;
            }
            if (t.containsKey("calculate")) {
                long all = player.getInventory().asList().stream().filter(item -> item.getItem().isSellable()).mapToLong(value -> (long) (value.getItem().getValue() * value.getAmount() * 0.9d)).sum();
                event.getChannel().sendMessage(String.format("%sYou will get **%d credits** if you sell all of your items!", EmoteReference.DIAMOND, all)).queue();
                return;
            }
            EmbedBuilder builder = baseEmbed(event, member.getEffectiveName() + "'s Inventory", member.getUser().getEffectiveAvatarUrl());
            List<ItemStack> list = player.getInventory().asList();
            List<MessageEmbed.Field> fields = new LinkedList<>();
            if (list.isEmpty())
                builder.setDescription("There is only dust here.");
            else
                player.getInventory().asList().forEach(stack -> {
                    long buyValue = stack.getItem().isBuyable() ? stack.getItem().getValue() : 0;
                    long sellValue = stack.getItem().isSellable() ? (long) (stack.getItem().getValue() * 0.9) : 0;
                    fields.add(new MessageEmbed.Field(stack.getItem().getEmoji() + " " + stack.getItem().getName() + " x " + stack.getAmount(), String.format("**Price**: \uD83D\uDCE5 %d \uD83D\uDCE4 %d\n%s", buyValue, sellValue, stack.getItem().getDesc()), false));
                });
            List<List<MessageEmbed.Field>> splitFields = DiscordUtils.divideFields(18, fields);
            boolean hasReactionPerms = event.getGuild().getSelfMember().hasPermission(event.getChannel(), Permission.MESSAGE_ADD_REACTION);
            if (hasReactionPerms) {
                DiscordUtils.list(event, 45, false, builder, splitFields);
            } else {
                DiscordUtils.listText(event, 45, false, builder, splitFields);
            }
        }

        @Override
        public MessageEmbed help(GuildMessageReceivedEvent event) {
            return helpEmbed(event, "Inventory command").setDescription("**Shows your current inventory.**\n" + "You can use `~>inventory -brief` to get a mobile friendly version.\n" + "Use `~>inventory -calculate` to see how much you'd get if you sell every sellable item on your inventory!").build();
        }
    });
    cr.registerAlias("inventory", "inv");
}
Also used : Items(net.kodehawa.mantarobot.commands.currency.item.Items) Badge(net.kodehawa.mantarobot.commands.currency.profile.Badge) Module(net.kodehawa.mantarobot.core.modules.Module) java.util(java.util) Command(net.kodehawa.mantarobot.core.modules.commands.base.Command) Member(net.dv8tion.jda.core.entities.Member) Utils(net.kodehawa.mantarobot.utils.Utils) RateLimiter(net.kodehawa.mantarobot.utils.commands.RateLimiter) DiscordUtils(net.kodehawa.mantarobot.utils.DiscordUtils) RethinkDB.r(com.rethinkdb.RethinkDB.r) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) Cursor(com.rethinkdb.net.Cursor) Permission(net.dv8tion.jda.core.Permission) CommandRegistry(net.kodehawa.mantarobot.core.CommandRegistry) Utils.handleDefaultRatelimit(net.kodehawa.mantarobot.utils.Utils.handleDefaultRatelimit) OptArgs(com.rethinkdb.model.OptArgs) Inventory(net.kodehawa.mantarobot.db.entities.helpers.Inventory) StringUtils(br.com.brjdevs.java.utils.texts.StringUtils) Subscribe(com.google.common.eventbus.Subscribe) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) MessageEmbed(net.dv8tion.jda.core.entities.MessageEmbed) ItemStack(net.kodehawa.mantarobot.commands.currency.item.ItemStack) Connection(com.rethinkdb.net.Connection) Player(net.kodehawa.mantarobot.db.entities.Player) SubCommand(net.kodehawa.mantarobot.core.modules.commands.SubCommand) Category(net.kodehawa.mantarobot.core.modules.commands.base.Category) Collectors(java.util.stream.Collectors) EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) TreeCommand(net.kodehawa.mantarobot.core.modules.commands.TreeCommand) java.awt(java.awt) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) Stream(java.util.stream.Stream) User(net.dv8tion.jda.core.entities.User) EmoteReference(net.kodehawa.mantarobot.utils.commands.EmoteReference) MantaroData(net.kodehawa.mantarobot.data.MantaroData) Item(net.kodehawa.mantarobot.commands.currency.item.Item) Player(net.kodehawa.mantarobot.db.entities.Player) MessageEmbed(net.dv8tion.jda.core.entities.MessageEmbed) EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) List(java.util.List) Member(net.dv8tion.jda.core.entities.Member) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) Subscribe(com.google.common.eventbus.Subscribe)

Example 18 with CommandRegistry

use of net.kodehawa.mantarobot.core.CommandRegistry in project MantaroBot by Mantaro.

the class CurrencyCmds method market.

@Subscribe
public void market(CommandRegistry cr) {
    final RateLimiter rateLimiter = new RateLimiter(TimeUnit.SECONDS, 8);
    TreeCommand marketCommand = (TreeCommand) cr.register("market", new TreeCommand(Category.CURRENCY) {

        @Override
        public Command defaultTrigger(GuildMessageReceivedEvent event, String mainCommand, String commandName) {
            return new SubCommand() {

                @Override
                protected void call(GuildMessageReceivedEvent event, String content) {
                    EmbedBuilder embed = baseEmbed(event, "Mantaro's Market").setThumbnail("https://png.icons8.com/metro/540/shopping-cart.png");
                    List<MessageEmbed.Field> fields = new LinkedList<>();
                    Stream.of(Items.ALL).forEach(item -> {
                        if (!item.isHidden()) {
                            String buyValue = item.isBuyable() ? String.format("$%d", item.getValue()) : "N/A";
                            String sellValue = item.isSellable() ? String.format("$%d", (int) Math.floor(item.getValue() * 0.9)) : "N/A";
                            fields.add(new MessageEmbed.Field(String.format("%s %s", item.getEmoji(), item.getName()), EmoteReference.BUY + buyValue + " " + EmoteReference.SELL + sellValue, true));
                        }
                    });
                    List<List<MessageEmbed.Field>> splitFields = DiscordUtils.divideFields(8, fields);
                    boolean hasReactionPerms = event.getGuild().getSelfMember().hasPermission(event.getChannel(), Permission.MESSAGE_ADD_REACTION);
                    if (hasReactionPerms) {
                        DiscordUtils.list(event, 120, false, embed, splitFields);
                    } else {
                        DiscordUtils.listText(event, 120, false, embed, splitFields);
                    }
                }
            };
        }

        @Override
        public MessageEmbed help(GuildMessageReceivedEvent event) {
            return helpEmbed(event, "Mantaro's market").setDescription("**List current items for buying and selling.**").addField("Buying and selling", "To buy do ~>market buy <item emoji>. It will subtract the value from your money" + " and give you the item.\n" + "To sell do `~>market sell all` to sell all your items or `~>market sell <item emoji>` to sell the specified item. " + "**You'll get the sell value of the item on coins to spend.**\n" + "You can check the value of a single item using `~>market price <item emoji>`\n" + "You can send an item to the trash using `~>market dump <amount> <item emoji>`\n" + "Use `~>inventory -calculate` to check how much is your inventory worth.", false).addField("To know", "If you don't have enough money you cannot buy the items.\n" + "Note: Don't use the item id, it's just for aesthetic reasons, the internal IDs are different than the ones shown here!", false).addField("Information", "To buy and sell multiple items you need to do `~>market <buy/sell> <amount> <item>`", false).build();
        }
    });
    marketCommand.setPredicate((event) -> {
        if (!handleDefaultRatelimit(rateLimiter, event.getAuthor(), event))
            return false;
        Player player = MantaroData.db().getPlayer(event.getMember());
        if (player.isLocked()) {
            event.getChannel().sendMessage(EmoteReference.ERROR + "You cannot access the market now.").queue();
            return false;
        }
        return true;
    });
    marketCommand.addSubCommand("dump", new SubCommand() {

        @Override
        protected void call(GuildMessageReceivedEvent event, String content) {
            String[] args = content.split(" ");
            String itemName = content;
            int itemNumber = 1;
            boolean isMassive = !itemName.isEmpty() && itemName.split(" ")[0].matches("^[0-9]*$");
            if (isMassive) {
                try {
                    itemNumber = Math.abs(Integer.valueOf(itemName.split(" ")[0]));
                    itemName = itemName.replace(args[0], "").trim();
                } catch (NumberFormatException e) {
                    event.getChannel().sendMessage(EmoteReference.ERROR + "Not a valid number of items to dump.").queue();
                    return;
                } catch (Exception e) {
                    onHelp(event);
                    return;
                }
            }
            Item item = Items.fromAny(itemName).orElse(null);
            if (item == null) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "Cannot check the dump a non-existent item!").queue();
                return;
            }
            Player player = MantaroData.db().getPlayer(event.getAuthor());
            if (!player.getInventory().containsItem(item)) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "Cannot dump an item you don't have!").queue();
                return;
            }
            if (player.getInventory().getAmount(item) < itemNumber) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "You cannot dump more items than what you have.").queue();
                return;
            }
            player.getInventory().process(new ItemStack(item, -itemNumber));
            player.saveAsync();
            event.getChannel().sendMessage(String.format("%sSent %dx **%s %s** to the trash!", EmoteReference.CORRECT, itemNumber, item.getEmoji(), item.getName())).queue();
        }
    }).createSubCommandAlias("dump", "trash");
    marketCommand.addSubCommand("price", new SubCommand() {

        @Override
        protected void call(GuildMessageReceivedEvent event, String content) {
            String[] args = content.split(" ");
            String itemName = content.replace(args[0] + " ", "");
            Item item = Items.fromAny(itemName).orElse(null);
            if (item == null) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "Cannot check the price of a non-existent item!").queue();
                return;
            }
            if (!item.isBuyable() && !item.isSellable()) {
                event.getChannel().sendMessage(EmoteReference.THINKING + "This item is not available neither for sell or buy (could be an exclusive collectible)").queue();
                return;
            }
            if (!item.isBuyable()) {
                event.getChannel().sendMessage(EmoteReference.EYES + "This is a collectible item. (Sell value: " + ((int) (item.getValue() * 0.9)) + " credits)").queue();
                return;
            }
            event.getChannel().sendMessage(String.format("%sThe market value of %s**%s** is %s credits to buy it and you can get %s credits if you sell it.", EmoteReference.MARKET, item.getEmoji(), item.getName(), item.getValue(), (int) (item.getValue() * 0.9))).queue();
        }
    });
    marketCommand.addSubCommand("sell", new SubCommand() {

        @Override
        protected void call(GuildMessageReceivedEvent event, String content) {
            Player player = MantaroData.db().getPlayer(event.getMember());
            String[] args = content.split(" ");
            String itemName = content;
            int itemNumber = 1;
            boolean isMassive = !itemName.isEmpty() && itemName.split(" ")[0].matches("^[0-9]*$");
            if (isMassive) {
                try {
                    itemNumber = Math.abs(Integer.valueOf(itemName.split(" ")[0]));
                    itemName = itemName.replace(args[0], "").trim();
                } catch (NumberFormatException e) {
                    event.getChannel().sendMessage(EmoteReference.ERROR + "Not a valid number of items to buy.").queue();
                    return;
                } catch (Exception e) {
                    onHelp(event);
                    return;
                }
            }
            try {
                if (args[0].equals("all")) {
                    long all = player.getInventory().asList().stream().filter(item -> item.getItem().isSellable()).mapToLong(value -> (long) (value.getItem().getValue() * value.getAmount() * 0.9d)).sum();
                    player.getInventory().clearOnlySellables();
                    player.addMoney(all);
                    event.getChannel().sendMessage(String.format("%sYou sold all your inventory items and gained %d credits!", EmoteReference.MONEY, all)).queue();
                    player.saveAsync();
                    return;
                }
                Item toSell = Items.fromAny(itemName).orElse(null);
                if (toSell == null) {
                    event.getChannel().sendMessage(EmoteReference.ERROR + "You cannot sell a non-existant item.").queue();
                    return;
                }
                if (!toSell.isSellable()) {
                    event.getChannel().sendMessage(EmoteReference.ERROR + "You cannot sell an item that cannot be sold.").queue();
                    return;
                }
                if (player.getInventory().getAmount(toSell) < 1) {
                    event.getChannel().sendMessage(EmoteReference.STOP + "You cannot sell an item you don't have.").queue();
                    return;
                }
                if (player.getInventory().getAmount(toSell) < itemNumber) {
                    event.getChannel().sendMessage(EmoteReference.ERROR + "You cannot sell more items than what you have.").queue();
                    return;
                }
                int many = itemNumber * -1;
                long amount = Math.round((toSell.getValue() * 0.9)) * Math.abs(many);
                player.getInventory().process(new ItemStack(toSell, many));
                player.addMoney(amount);
                player.getData().setMarketUsed(player.getData().getMarketUsed() + 1);
                event.getChannel().sendMessage(String.format("%sYou sold %d **%s** and gained %d credits!", EmoteReference.CORRECT, Math.abs(many), toSell.getName(), amount)).queue();
                player.saveAsync();
            } catch (Exception e) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "Invalid syntax.").queue();
            }
        }
    });
    marketCommand.addSubCommand("buy", new SubCommand() {

        @Override
        protected void call(GuildMessageReceivedEvent event, String content) {
            Player player = MantaroData.db().getPlayer(event.getMember());
            String[] args = content.split(" ");
            String itemName = content;
            int itemNumber = 1;
            boolean isMassive = !itemName.isEmpty() && itemName.split(" ")[0].matches("^[0-9]*$");
            if (isMassive) {
                try {
                    itemNumber = Math.abs(Integer.valueOf(itemName.split(" ")[0]));
                    itemName = itemName.replace(args[0], "").trim();
                } catch (Exception e) {
                    if (e instanceof NumberFormatException) {
                        event.getChannel().sendMessage(EmoteReference.ERROR + "Not a valid number of items to buy.").queue();
                    } else {
                        onHelp(event);
                        return;
                    }
                }
            }
            Item itemToBuy = Items.fromAnyNoId(itemName).orElse(null);
            if (itemToBuy == null) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "You cannot buy an unexistant item.").queue();
                return;
            }
            try {
                if (!itemToBuy.isBuyable()) {
                    event.getChannel().sendMessage(EmoteReference.ERROR + "You cannot buy an item that cannot be bought.").queue();
                    return;
                }
                ItemStack stack = player.getInventory().getStackOf(itemToBuy);
                if (stack != null && !stack.canJoin(new ItemStack(itemToBuy, itemNumber))) {
                    // assume overflow
                    event.getChannel().sendMessage(EmoteReference.ERROR + "You cannot buy more of that object!").queue();
                    return;
                }
                if (player.removeMoney(itemToBuy.getValue() * itemNumber)) {
                    player.getInventory().process(new ItemStack(itemToBuy, itemNumber));
                    player.getData().addBadgeIfAbsent(Badge.BUYER);
                    player.getData().setMarketUsed(player.getData().getMarketUsed() + 1);
                    player.saveAsync();
                    event.getChannel().sendMessage(String.format("%sBought %d %s for %d credits successfully. You now have %d credits.", EmoteReference.OK, itemNumber, itemToBuy.getEmoji(), itemToBuy.getValue() * itemNumber, player.getMoney())).queue();
                } else {
                    event.getChannel().sendMessage(EmoteReference.STOP + "You don't have enough money to buy this item.").queue();
                }
            } catch (Exception e) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "Invalid syntax.").queue();
            }
        }
    });
}
Also used : Items(net.kodehawa.mantarobot.commands.currency.item.Items) Badge(net.kodehawa.mantarobot.commands.currency.profile.Badge) Module(net.kodehawa.mantarobot.core.modules.Module) java.util(java.util) Command(net.kodehawa.mantarobot.core.modules.commands.base.Command) Member(net.dv8tion.jda.core.entities.Member) Utils(net.kodehawa.mantarobot.utils.Utils) RateLimiter(net.kodehawa.mantarobot.utils.commands.RateLimiter) DiscordUtils(net.kodehawa.mantarobot.utils.DiscordUtils) RethinkDB.r(com.rethinkdb.RethinkDB.r) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) Cursor(com.rethinkdb.net.Cursor) Permission(net.dv8tion.jda.core.Permission) CommandRegistry(net.kodehawa.mantarobot.core.CommandRegistry) Utils.handleDefaultRatelimit(net.kodehawa.mantarobot.utils.Utils.handleDefaultRatelimit) OptArgs(com.rethinkdb.model.OptArgs) Inventory(net.kodehawa.mantarobot.db.entities.helpers.Inventory) StringUtils(br.com.brjdevs.java.utils.texts.StringUtils) Subscribe(com.google.common.eventbus.Subscribe) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) MessageEmbed(net.dv8tion.jda.core.entities.MessageEmbed) ItemStack(net.kodehawa.mantarobot.commands.currency.item.ItemStack) Connection(com.rethinkdb.net.Connection) Player(net.kodehawa.mantarobot.db.entities.Player) SubCommand(net.kodehawa.mantarobot.core.modules.commands.SubCommand) Category(net.kodehawa.mantarobot.core.modules.commands.base.Category) Collectors(java.util.stream.Collectors) EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) TreeCommand(net.kodehawa.mantarobot.core.modules.commands.TreeCommand) java.awt(java.awt) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) Stream(java.util.stream.Stream) User(net.dv8tion.jda.core.entities.User) EmoteReference(net.kodehawa.mantarobot.utils.commands.EmoteReference) MantaroData(net.kodehawa.mantarobot.data.MantaroData) Item(net.kodehawa.mantarobot.commands.currency.item.Item) Player(net.kodehawa.mantarobot.db.entities.Player) SubCommand(net.kodehawa.mantarobot.core.modules.commands.SubCommand) MessageEmbed(net.dv8tion.jda.core.entities.MessageEmbed) RateLimiter(net.kodehawa.mantarobot.utils.commands.RateLimiter) Item(net.kodehawa.mantarobot.commands.currency.item.Item) EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) List(java.util.List) ItemStack(net.kodehawa.mantarobot.commands.currency.item.ItemStack) TreeCommand(net.kodehawa.mantarobot.core.modules.commands.TreeCommand) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) Subscribe(com.google.common.eventbus.Subscribe)

Example 19 with CommandRegistry

use of net.kodehawa.mantarobot.core.CommandRegistry in project MantaroBot by Mantaro.

the class DebugCmds method ping.

@Subscribe
public void ping(CommandRegistry cr) {
    final RateLimiter rateLimiter = new RateLimiter(TimeUnit.SECONDS, 5, true);
    final Random r = new Random();
    final String[] pingQuotes = { "W-Was I fast enough?", "What are you doing?", "W-What are you looking at?!", "Huh.", "Did I do well?", "What do you think?", "Does this happen often?", "Am I performing p-properly?", "<3", "*pats*", "Pong.", "Pang.", "Pung.", "Peng.", "Ping-pong? Yay!", "U-Uh... h-hi" };
    cr.register("ping", new SimpleCommand(Category.INFO) {

        @Override
        protected void call(GuildMessageReceivedEvent event, String content, String[] args) {
            if (!handleDefaultRatelimit(rateLimiter, event.getAuthor(), event))
                return;
            long start = System.currentTimeMillis();
            event.getChannel().sendTyping().queue(v -> {
                long ping = System.currentTimeMillis() - start;
                event.getChannel().sendMessage(EmoteReference.MEGA + "*" + pingQuotes[r.nextInt(pingQuotes.length)] + "* - My ping: " + ping + " ms (" + ratePing(ping) + ")  `Websocket:" + event.getJDA().getPing() + "ms`").queue();
                TextChannelGround.of(event).dropItemWithChance(5, 5);
            });
        }

        @Override
        public MessageEmbed help(GuildMessageReceivedEvent event) {
            return helpEmbed(event, "Ping Command").setDescription("**Plays Ping-Pong with Discord and prints out the result.**").build();
        }
    });
}
Also used : MantaroInfo(net.kodehawa.mantarobot.MantaroInfo) Module(net.kodehawa.mantarobot.core.modules.Module) DefaultCommandProcessor(net.kodehawa.mantarobot.core.processor.DefaultCommandProcessor) Utils(net.kodehawa.mantarobot.utils.Utils) RateLimiter(net.kodehawa.mantarobot.utils.commands.RateLimiter) Random(java.util.Random) DiscordUtils(net.kodehawa.mantarobot.utils.DiscordUtils) MantaroBot(net.kodehawa.mantarobot.MantaroBot) MessageBuilder(net.dv8tion.jda.core.MessageBuilder) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) CommandRegistry(net.kodehawa.mantarobot.core.CommandRegistry) Utils.handleDefaultRatelimit(net.kodehawa.mantarobot.utils.Utils.handleDefaultRatelimit) SnowflakeCacheView(net.dv8tion.jda.core.utils.cache.SnowflakeCacheView) JDA(net.dv8tion.jda.core.JDA) Subscribe(com.google.common.eventbus.Subscribe) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) ManagementFactory(java.lang.management.ManagementFactory) LinkedList(java.util.LinkedList) MessageEmbed(net.dv8tion.jda.core.entities.MessageEmbed) TextChannelGround(net.kodehawa.mantarobot.commands.currency.TextChannelGround) CommandListener(net.kodehawa.mantarobot.core.listeners.command.CommandListener) VoiceChannel(net.dv8tion.jda.core.entities.VoiceChannel) JDAInfo(net.dv8tion.jda.core.JDAInfo) Category(net.kodehawa.mantarobot.core.modules.commands.base.Category) MantaroListener(net.kodehawa.mantarobot.core.listeners.MantaroListener) AsyncInfoMonitor(net.kodehawa.mantarobot.commands.info.AsyncInfoMonitor) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) TimeUnit(java.util.concurrent.TimeUnit) Guild(net.dv8tion.jda.core.entities.Guild) List(java.util.List) PlayerLibrary(com.sedmelluq.discord.lavaplayer.tools.PlayerLibrary) User(net.dv8tion.jda.core.entities.User) EmoteReference(net.kodehawa.mantarobot.utils.commands.EmoteReference) PreLoadEvent(net.kodehawa.mantarobot.core.listeners.events.PreLoadEvent) MantaroShard(net.kodehawa.mantarobot.core.shard.MantaroShard) MessageEmbed(net.dv8tion.jda.core.entities.MessageEmbed) Random(java.util.Random) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) RateLimiter(net.kodehawa.mantarobot.utils.commands.RateLimiter) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) Subscribe(com.google.common.eventbus.Subscribe)

Example 20 with CommandRegistry

use of net.kodehawa.mantarobot.core.CommandRegistry in project MantaroBot by Mantaro.

the class InfoCmds method help.

@Subscribe
public void help(CommandRegistry cr) {
    Random r = new Random();
    List<String> jokes = Collections.unmodifiableList(Arrays.asList("Yo damn I heard you like help, because you just issued the help command to get the help about the help command.", "Congratulations, you managed to use the help command.", "Helps you to help yourself.", "Help Inception.", "A help helping helping helping help.", "I wonder if this is what you are looking for..."));
    cr.register("help", new SimpleCommand(Category.INFO) {

        @Override
        protected void call(GuildMessageReceivedEvent event, String content, String[] args) {
            if (content.isEmpty()) {
                DBGuild dbGuild = MantaroData.db().getGuild(event.getGuild());
                String defaultPrefix = MantaroData.config().get().prefix[0], guildPrefix = dbGuild.getData().getGuildCustomPrefix();
                String prefix = guildPrefix == null ? defaultPrefix : guildPrefix;
                GuildData guildData = dbGuild.getData();
                EmbedBuilder embed = baseEmbed(event, "Mantaro Help").setColor(Color.PINK).setDescription("Command list. For a detailed guide on the usage of Mantaro, please check the [wiki](https://github.com/Mantaro/MantaroBot/wiki).\n" + "If you have issues or inquiries while using Mantaro, please join the [support server](https://is.gd/mantaroguild)\n" + "[We need your help to keep Mantaro online! Click here for more info.](https://www.patreon.com/mantaro)\n" + (guildData.getDisabledCommands().isEmpty() ? "" : "\nOnly showing non-disabled commands. Total disabled commands: " + guildData.getDisabledCommands().size()) + (guildData.getChannelSpecificDisabledCommands().get(event.getChannel().getId()) == null || guildData.getChannelSpecificDisabledCommands().get(event.getChannel().getId()).isEmpty() ? "" : "\nOnly showing non-disabled commands. Total channel-specific disabled commands: " + guildData.getChannelSpecificDisabledCommands().get(event.getChannel().getId()).size())).setFooter(String.format("To check command usage, type %shelp <command> // -> Commands: " + DefaultCommandProcessor.REGISTRY.commands().values().stream().filter(c -> c.category() != null).count(), prefix), null);
                Arrays.stream(Category.values()).filter(c -> c != Category.CURRENCY || !MantaroData.config().get().isPremiumBot()).filter(c -> c != Category.OWNER || CommandPermission.OWNER.test(event.getMember())).forEach(c -> embed.addField(c + " Commands:", forType(event.getChannel(), guildData, c), false));
                event.getChannel().sendMessage(embed.build()).queue();
            } else {
                Command command = DefaultCommandProcessor.REGISTRY.commands().get(content);
                if (command != null) {
                    final MessageEmbed help = command.help(event);
                    if (help != null) {
                        event.getChannel().sendMessage(help).queue();
                    } else {
                        event.getChannel().sendMessage(EmoteReference.ERROR + "There's no extended help set for this command.").queue();
                    }
                } else {
                    event.getChannel().sendMessage(EmoteReference.ERROR + "A command with this name doesn't exist").queue();
                }
            }
        }

        @Override
        public MessageEmbed help(GuildMessageReceivedEvent event) {
            return helpEmbed(event, "Help Command").setColor(Color.PINK).setDescription("**" + jokes.get(r.nextInt(jokes.size())) + "**").addField("Usage", "`~>help` - **Returns a list of commands that you can use**.\n" + "`~>help <command>` - **Return information about the command specified**.", false).build();
        }
    });
    cr.registerAlias("help", "commands");
    // why not
    cr.registerAlias("help", "halp");
}
Also used : MantaroInfo(net.kodehawa.mantarobot.MantaroInfo) Module(net.kodehawa.mantarobot.core.modules.Module) java.util(java.util) DefaultCommandProcessor(net.kodehawa.mantarobot.core.processor.DefaultCommandProcessor) Command(net.kodehawa.mantarobot.core.modules.commands.base.Command) Utils(net.kodehawa.mantarobot.utils.Utils) DiscordUtils(net.kodehawa.mantarobot.utils.DiscordUtils) MantaroBot(net.kodehawa.mantarobot.MantaroBot) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) Permission(net.dv8tion.jda.core.Permission) CommandRegistry(net.kodehawa.mantarobot.core.CommandRegistry) SnowflakeCacheView(net.dv8tion.jda.core.utils.cache.SnowflakeCacheView) Subscribe(com.google.common.eventbus.Subscribe) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) net.kodehawa.mantarobot.commands.info.stats.manager(net.kodehawa.mantarobot.commands.info.stats.manager) SimpleFileDataManager(net.kodehawa.mantarobot.utils.data.SimpleFileDataManager) ManagementFactory(java.lang.management.ManagementFactory) TextChannelGround(net.kodehawa.mantarobot.commands.currency.TextChannelGround) CommandListener(net.kodehawa.mantarobot.core.listeners.command.CommandListener) SubCommand(net.kodehawa.mantarobot.core.modules.commands.SubCommand) net.dv8tion.jda.core.entities(net.dv8tion.jda.core.entities) Category(net.kodehawa.mantarobot.core.modules.commands.base.Category) AsyncInfoMonitor(net.kodehawa.mantarobot.commands.info.AsyncInfoMonitor) DBGuild(net.kodehawa.mantarobot.db.entities.DBGuild) Collectors(java.util.stream.Collectors) EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) OnlineStatus(net.dv8tion.jda.core.OnlineStatus) TreeCommand(net.kodehawa.mantarobot.core.modules.commands.TreeCommand) java.awt(java.awt) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) CommandPermission(net.kodehawa.mantarobot.core.modules.commands.base.CommandPermission) StatsHelper.calculateInt(net.kodehawa.mantarobot.commands.info.stats.StatsHelper.calculateInt) BLUE_SMALL_MARKER(net.kodehawa.mantarobot.utils.commands.EmoteReference.BLUE_SMALL_MARKER) GuildData(net.kodehawa.mantarobot.db.entities.helpers.GuildData) EmoteReference(net.kodehawa.mantarobot.utils.commands.EmoteReference) DateTimeFormatter(java.time.format.DateTimeFormatter) MantaroData(net.kodehawa.mantarobot.data.MantaroData) HelpUtils.forType(net.kodehawa.mantarobot.commands.info.HelpUtils.forType) StatsHelper.calculateDouble(net.kodehawa.mantarobot.commands.info.stats.StatsHelper.calculateDouble) GuildData(net.kodehawa.mantarobot.db.entities.helpers.GuildData) EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) DBGuild(net.kodehawa.mantarobot.db.entities.DBGuild) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) Command(net.kodehawa.mantarobot.core.modules.commands.base.Command) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) SubCommand(net.kodehawa.mantarobot.core.modules.commands.SubCommand) TreeCommand(net.kodehawa.mantarobot.core.modules.commands.TreeCommand) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

Subscribe (com.google.common.eventbus.Subscribe)21 GuildMessageReceivedEvent (net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent)21 CommandRegistry (net.kodehawa.mantarobot.core.CommandRegistry)21 Module (net.kodehawa.mantarobot.core.modules.Module)21 Category (net.kodehawa.mantarobot.core.modules.commands.base.Category)21 EmoteReference (net.kodehawa.mantarobot.utils.commands.EmoteReference)21 SimpleCommand (net.kodehawa.mantarobot.core.modules.commands.SimpleCommand)20 MantaroData (net.kodehawa.mantarobot.data.MantaroData)20 Utils (net.kodehawa.mantarobot.utils.Utils)17 TimeUnit (java.util.concurrent.TimeUnit)16 List (java.util.List)15 MantaroBot (net.kodehawa.mantarobot.MantaroBot)15 EmbedBuilder (net.dv8tion.jda.core.EmbedBuilder)14 Collectors (java.util.stream.Collectors)13 MessageEmbed (net.dv8tion.jda.core.entities.MessageEmbed)13 DiscordUtils (net.kodehawa.mantarobot.utils.DiscordUtils)13 java.awt (java.awt)12 java.util (java.util)12 Command (net.kodehawa.mantarobot.core.modules.commands.base.Command)11 Permission (net.dv8tion.jda.core.Permission)10