Search in sources :

Example 46 with GuildMessageReceivedEvent

use of net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent 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 47 with GuildMessageReceivedEvent

use of net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent 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 48 with GuildMessageReceivedEvent

use of net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent in project MantaroBot by Mantaro.

the class FunCmds method ratewaifu.

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

        @Override
        protected void call(GuildMessageReceivedEvent event, String content, String[] args) {
            if (args.length == 0) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "Give me a waifu to rate!").queue();
                return;
            }
            int waifuRate = content.replaceAll("\\s+", " ").replaceAll("<@!?(\\d+)>", "<@$1>").chars().sum() % 101;
            if (content.equalsIgnoreCase("mantaro"))
                waifuRate = 100;
            new MessageBuilder().setContent(String.format("%sI rate %s with a **%d/100**", EmoteReference.THINKING, content, waifuRate)).stripMentions(event.getGuild(), Message.MentionType.EVERYONE, Message.MentionType.HERE).sendTo(event.getChannel()).queue();
        }

        @Override
        public MessageEmbed help(GuildMessageReceivedEvent event) {
            return helpEmbed(event, "Rate your waifu").setDescription("**Just rates your waifu from zero to 100. Results may vary.**").build();
        }
    });
    cr.registerAlias("ratewaifu", "rw");
}
Also used : MessageEmbed(net.dv8tion.jda.core.entities.MessageEmbed) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) MessageBuilder(net.dv8tion.jda.core.MessageBuilder) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) Subscribe(com.google.common.eventbus.Subscribe)

Example 49 with GuildMessageReceivedEvent

use of net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent in project MantaroBot by Mantaro.

the class FunCmds method coinflip.

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

        @Override
        protected void call(GuildMessageReceivedEvent event, String content, String[] args) {
            int times;
            if (args.length == 0 || content.length() == 0)
                times = 1;
            else {
                try {
                    times = Integer.parseInt(args[0]);
                    if (times > 1000) {
                        event.getChannel().sendMessage(EmoteReference.ERROR + "Hold in there! The limit is 1,000 coin flips").queue();
                        return;
                    }
                } catch (NumberFormatException nfe) {
                    event.getChannel().sendMessage(EmoteReference.ERROR + "You need to specify an Integer for the amount of repetitions").queue();
                    return;
                }
            }
            final int[] heads = { 0 };
            final int[] tails = { 0 };
            doTimes(times, () -> {
                if (r.nextBoolean())
                    heads[0]++;
                else
                    tails[0]++;
            });
            String flips = times == 1 ? "time" : "times";
            event.getChannel().sendMessage(String.format("%s Your result from **%d** %s yielded **%d** heads and **%d** tails", EmoteReference.PENNY, times, flips, heads[0], tails[0])).queue();
        }

        @Override
        public MessageEmbed help(GuildMessageReceivedEvent event) {
            return helpEmbed(event, "Coinflip command").setDescription("**Flips a coin with a defined number of repetitions**").addField("Usage", "`~>coinflip <number of times>` - **Flips a coin x number of times**", false).build();
        }
    });
}
Also used : MessageEmbed(net.dv8tion.jda.core.entities.MessageEmbed) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) Subscribe(com.google.common.eventbus.Subscribe)

Example 50 with GuildMessageReceivedEvent

use of net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent in project MantaroBot by Mantaro.

the class GameCmds method startMultipleGames.

private void startMultipleGames(LinkedList<Game> games, GuildMessageReceivedEvent event) {
    if (checkRunning(event))
        return;
    List<String> players = new ArrayList<>();
    players.add(event.getAuthor().getId());
    if (!event.getMessage().getMentionedRoles().isEmpty()) {
        StringBuilder b = new StringBuilder();
        event.getMessage().getMentionedRoles().forEach(role -> event.getGuild().getMembersWithRoles(role).forEach(user -> {
            if (!user.getUser().getId().equals(event.getJDA().getSelfUser().getId()))
                players.add(user.getUser().getId());
            b.append(user.getEffectiveName()).append(" ");
        }));
        event.getChannel().sendMessage(EmoteReference.MEGA + "Started a MP lobby with all users with the specfied role: " + b.toString()).queue();
    }
    if (!event.getMessage().getMentionedUsers().isEmpty()) {
        StringBuilder builder = new StringBuilder();
        event.getMessage().getMentionedUsers().forEach(user -> {
            if (!user.getId().equals(event.getJDA().getSelfUser().getId()) && !user.isBot())
                players.add(user.getId());
            builder.append(user.getName()).append(" ");
        });
        if (players.size() > 1) {
            event.getChannel().sendMessage(EmoteReference.MEGA + "Started a MP lobby with users: " + builder.toString()).queue();
        }
    }
    event.getChannel().sendMessage(EmoteReference.CORRECT + "Started a new lobby! **Games: " + games.stream().map(Game::name).collect(Collectors.joining(", ")) + "**\n" + "You can type `endlobby` to end all games and finish the lobby.").queue();
    GameLobby lobby = new GameLobby(event, players, games);
    lobby.startFirstGame();
}
Also used : GuessTheNumber(net.kodehawa.mantarobot.commands.game.GuessTheNumber) Module(net.kodehawa.mantarobot.core.modules.Module) GameLobby(net.kodehawa.mantarobot.commands.game.core.GameLobby) Member(net.dv8tion.jda.core.entities.Member) SimpleTreeCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleTreeCommand) Utils(net.kodehawa.mantarobot.utils.Utils) RateLimiter(net.kodehawa.mantarobot.utils.commands.RateLimiter) NewRateLimiter(net.kodehawa.mantarobot.utils.commands.NewRateLimiter) ArrayList(java.util.ArrayList) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) CommandRegistry(net.kodehawa.mantarobot.core.CommandRegistry) Subscribe(com.google.common.eventbus.Subscribe) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) LinkedList(java.util.LinkedList) MessageEmbed(net.dv8tion.jda.core.entities.MessageEmbed) Character(net.kodehawa.mantarobot.commands.game.Character) SubCommand(net.kodehawa.mantarobot.core.modules.commands.SubCommand) Game(net.kodehawa.mantarobot.commands.game.core.Game) Category(net.kodehawa.mantarobot.core.modules.commands.base.Category) SPLIT_PATTERN(net.kodehawa.mantarobot.utils.StringUtils.SPLIT_PATTERN) Trivia(net.kodehawa.mantarobot.commands.game.Trivia) DBGuild(net.kodehawa.mantarobot.db.entities.DBGuild) Collectors(java.util.stream.Collectors) Executors(java.util.concurrent.Executors) TimeUnit(java.util.concurrent.TimeUnit) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) Pokemon(net.kodehawa.mantarobot.commands.game.Pokemon) EmoteReference(net.kodehawa.mantarobot.utils.commands.EmoteReference) MantaroData(net.kodehawa.mantarobot.data.MantaroData) Pattern(java.util.regex.Pattern) Game(net.kodehawa.mantarobot.commands.game.core.Game) GameLobby(net.kodehawa.mantarobot.commands.game.core.GameLobby) ArrayList(java.util.ArrayList)

Aggregations

GuildMessageReceivedEvent (net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent)68 Subscribe (com.google.common.eventbus.Subscribe)50 SimpleCommand (net.kodehawa.mantarobot.core.modules.commands.SimpleCommand)48 MessageEmbed (net.dv8tion.jda.core.entities.MessageEmbed)42 EmoteReference (net.kodehawa.mantarobot.utils.commands.EmoteReference)36 MantaroData (net.kodehawa.mantarobot.data.MantaroData)34 List (java.util.List)28 Category (net.kodehawa.mantarobot.core.modules.commands.base.Category)27 EmbedBuilder (net.dv8tion.jda.core.EmbedBuilder)26 Utils (net.kodehawa.mantarobot.utils.Utils)26 TimeUnit (java.util.concurrent.TimeUnit)25 Collectors (java.util.stream.Collectors)25 CommandRegistry (net.kodehawa.mantarobot.core.CommandRegistry)25 Module (net.kodehawa.mantarobot.core.modules.Module)25 MantaroBot (net.kodehawa.mantarobot.MantaroBot)19 SubCommand (net.kodehawa.mantarobot.core.modules.commands.SubCommand)18 DBGuild (net.kodehawa.mantarobot.db.entities.DBGuild)18 RateLimiter (net.kodehawa.mantarobot.utils.commands.RateLimiter)18 Slf4j (lombok.extern.slf4j.Slf4j)17 Player (net.kodehawa.mantarobot.db.entities.Player)17