Search in sources :

Example 21 with SimpleCommand

use of net.kodehawa.mantarobot.core.modules.commands.SimpleCommand in project MantaroBot by Mantaro.

the class ModerationOptions method onRegistry.

@Subscribe
public void onRegistry(OptionRegistryEvent e) {
    registerOption("localblacklist:add", "Local Blacklist add", "Adds someone to the local blacklist.\n" + "You need to mention the user. You can mention multiple users.\n" + "**Example:** `~>opts localblacklist add @user1 @user2`", "Adds someone to the local blacklist.", (event, args) -> {
        List<User> mentioned = event.getMessage().getMentionedUsers();
        if (mentioned.isEmpty()) {
            event.getChannel().sendMessage(EmoteReference.ERROR + "**You need to specify the users to locally blacklist.**").queue();
            return;
        }
        if (mentioned.contains(event.getAuthor())) {
            event.getChannel().sendMessage(EmoteReference.ERROR + "Why are you trying to blacklist yourself?...").queue();
            return;
        }
        Guild guild = event.getGuild();
        if (mentioned.stream().anyMatch(u -> CommandPermission.ADMIN.test(guild.getMember(u)))) {
            event.getChannel().sendMessage(EmoteReference.ERROR + "One (or more) of the users you're trying to blacklist are admins or Bot Commanders!").queue();
            return;
        }
        DBGuild dbGuild = MantaroData.db().getGuild(guild);
        GuildData guildData = dbGuild.getData();
        List<String> toBlackList = mentioned.stream().map(ISnowflake::getId).collect(Collectors.toList());
        String blacklisted = mentioned.stream().map(user -> user.getName() + "#" + user.getDiscriminator()).collect(Collectors.joining(","));
        guildData.getDisabledUsers().addAll(toBlackList);
        dbGuild.save();
        event.getChannel().sendMessage(EmoteReference.CORRECT + "Locally blacklisted users: **" + blacklisted + "**").queue();
    });
    registerOption("localblacklist:remove", "Local Blacklist remove", "Removes someone from the local blacklist.\n" + "You need to mention the user. You can mention multiple users.\n" + "**Example:** `~>opts localblacklist remove @user1 @user2`", "Removes someone from the local blacklist.", (event, args) -> {
        List<User> mentioned = event.getMessage().getMentionedUsers();
        if (mentioned.isEmpty()) {
            event.getChannel().sendMessage(EmoteReference.ERROR + "**You need to specify the users to locally blacklist.**").queue();
            return;
        }
        DBGuild dbGuild = MantaroData.db().getGuild(event.getGuild());
        GuildData guildData = dbGuild.getData();
        List<String> toUnBlackList = mentioned.stream().map(ISnowflake::getId).collect(Collectors.toList());
        String unBlackListed = mentioned.stream().map(user -> user.getName() + "#" + user.getDiscriminator()).collect(Collectors.joining(","));
        guildData.getDisabledUsers().removeAll(toUnBlackList);
        dbGuild.save();
        event.getChannel().sendMessage(EmoteReference.CORRECT + "Locally unblacklisted users: **" + unBlackListed + "**").queue();
    });
    // region logs
    // region enable
    registerOption("logs:enable", "Enable logs", "Enables logs. You need to use the channel name.\n" + "**Example:** `~>opts logs enable mod-logs`", "Enables logs.", (event, args) -> {
        if (args.length < 1) {
            onHelp(event);
            return;
        }
        String logChannel = args[0];
        DBGuild dbGuild = MantaroData.db().getGuild(event.getGuild());
        GuildData guildData = dbGuild.getData();
        Consumer<TextChannel> consumer = textChannel -> {
            guildData.setGuildLogChannel(textChannel.getId());
            dbGuild.saveAsync();
            event.getChannel().sendMessage(String.format(EmoteReference.MEGA + "Message logging has been enabled with parameters -> ``Channel #%s (%s)``", textChannel.getName(), textChannel.getId())).queue();
        };
        TextChannel channel = Utils.findChannelSelect(event, logChannel, consumer);
        if (channel != null) {
            consumer.accept(channel);
        }
    });
    registerOption("logs:exclude", "Exclude log channel.", "Excludes a channel from logging. You need to use the channel name, *not* the mention.\n" + "**Example:** `~>opts logs exclude staff`", "Excludes a channel from logging.", (event, args) -> {
        if (args.length == 0) {
            onHelp(event);
            return;
        }
        DBGuild dbGuild = MantaroData.db().getGuild(event.getGuild());
        GuildData guildData = dbGuild.getData();
        if (args[0].equals("clearchannels")) {
            guildData.getLogExcludedChannels().clear();
            dbGuild.saveAsync();
            event.getChannel().sendMessage(EmoteReference.OK + "Cleared log exceptions!").queue();
            return;
        }
        if (args[0].equals("remove")) {
            if (args.length < 2) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "Incorrect argument length.").queue();
                return;
            }
            String channel = args[1];
            List<TextChannel> channels = event.getGuild().getTextChannelsByName(channel, true);
            if (channels.size() == 0) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "I didn't find a channel with that name!").queue();
            } else if (channels.size() == 1) {
                TextChannel ch = channels.get(0);
                guildData.getLogExcludedChannels().remove(ch.getId());
                dbGuild.saveAsync();
                event.getChannel().sendMessage(EmoteReference.OK + "Removed logs exception on channel: " + ch.getAsMention()).queue();
            } else {
                DiscordUtils.selectList(event, channels, ch -> String.format("%s (ID: %s)", ch.getName(), ch.getId()), s -> ((SimpleCommand) optsCmd).baseEmbed(event, "Select the Channel:").setDescription(s).build(), ch -> {
                    guildData.getLogExcludedChannels().remove(ch.getId());
                    dbGuild.saveAsync();
                    event.getChannel().sendMessage(EmoteReference.OK + "Removed logs exception on channel: " + ch.getAsMention()).queue();
                });
            }
            return;
        }
        String channel = args[0];
        List<TextChannel> channels = event.getGuild().getTextChannelsByName(channel, true);
        if (channels.size() == 0) {
            event.getChannel().sendMessage(EmoteReference.ERROR + "I didn't find a channel with that name!").queue();
        } else if (channels.size() == 1) {
            TextChannel ch = channels.get(0);
            guildData.getLogExcludedChannels().add(ch.getId());
            dbGuild.saveAsync();
            event.getChannel().sendMessage(EmoteReference.OK + "Added logs exception on channel: " + ch.getAsMention()).queue();
        } else {
            DiscordUtils.selectList(event, channels, ch -> String.format("%s (ID: %s)", ch.getName(), ch.getId()), s -> ((SimpleCommand) optsCmd).baseEmbed(event, "Select the Channel:").setDescription(s).build(), ch -> {
                guildData.getLogExcludedChannels().add(ch.getId());
                dbGuild.saveAsync();
                event.getChannel().sendMessage(EmoteReference.OK + "Added logs exception on channel: " + ch.getAsMention()).queue();
            });
        }
    });
    // endregion
    // region disable
    registerOption("logs:disable", "Disable logs", "Disables logs.\n" + "**Example:** `~>opts logs disable`", "Disables logs.", (event) -> {
        DBGuild dbGuild = MantaroData.db().getGuild(event.getGuild());
        GuildData guildData = dbGuild.getData();
        guildData.setGuildLogChannel(null);
        dbGuild.saveAsync();
        event.getChannel().sendMessage(EmoteReference.MEGA + "Message logging has been disabled.").queue();
    });
// endregion
// endregion
}
Also used : TextChannel(net.dv8tion.jda.core.entities.TextChannel) Option(net.kodehawa.mantarobot.options.annotations.Option) Utils(net.kodehawa.mantarobot.utils.Utils) DiscordUtils(net.kodehawa.mantarobot.utils.DiscordUtils) DBGuild(net.kodehawa.mantarobot.db.entities.DBGuild) Collectors(java.util.stream.Collectors) Consumer(java.util.function.Consumer) Guild(net.dv8tion.jda.core.entities.Guild) List(java.util.List) User(net.dv8tion.jda.core.entities.User) CommandPermission(net.kodehawa.mantarobot.core.modules.commands.base.CommandPermission) ISnowflake(net.dv8tion.jda.core.entities.ISnowflake) GuildData(net.kodehawa.mantarobot.db.entities.helpers.GuildData) EmoteReference(net.kodehawa.mantarobot.utils.commands.EmoteReference) MantaroData(net.kodehawa.mantarobot.data.MantaroData) Subscribe(com.google.common.eventbus.Subscribe) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) OptionType(net.kodehawa.mantarobot.options.core.OptionType) OptionRegistryEvent(net.kodehawa.mantarobot.options.event.OptionRegistryEvent) OptionHandler(net.kodehawa.mantarobot.options.core.OptionHandler) OptsCmd.optsCmd(net.kodehawa.mantarobot.commands.OptsCmd.optsCmd) GuildData(net.kodehawa.mantarobot.db.entities.helpers.GuildData) TextChannel(net.dv8tion.jda.core.entities.TextChannel) User(net.dv8tion.jda.core.entities.User) DBGuild(net.kodehawa.mantarobot.db.entities.DBGuild) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) DBGuild(net.kodehawa.mantarobot.db.entities.DBGuild) Guild(net.dv8tion.jda.core.entities.Guild) Subscribe(com.google.common.eventbus.Subscribe)

Example 22 with SimpleCommand

use of net.kodehawa.mantarobot.core.modules.commands.SimpleCommand in project MantaroBot by Mantaro.

the class UtilsCmds method weather.

@Subscribe
public void weather(CommandRegistry registry) {
    registry.register("weather", new SimpleCommand(Category.UTILS) {

        @Override
        protected void call(GuildMessageReceivedEvent event, String content, String[] args) {
            if (content.isEmpty()) {
                onError(event);
                return;
            }
            EmbedBuilder embed = new EmbedBuilder();
            try {
                long start = System.currentTimeMillis();
                WeatherData data = GsonDataManager.GSON_PRETTY.fromJson(Utils.wgetResty(String.format("http://api.openweathermap.org/data/2.5/weather?q=%s&appid=%s", URLEncoder.encode(content, "UTF-8"), MantaroData.config().get().weatherAppId), event), WeatherData.class);
                String countryCode = data.getSys().country;
                String status = data.getWeather().get(0).main;
                Double temp = data.getMain().getTemp();
                double pressure = data.getMain().getPressure();
                int humidity = data.getMain().getHumidity();
                Double ws = data.getWind().speed;
                int cloudiness = data.getClouds().all;
                Double finalTemperatureCelsius = temp - 273.15;
                Double finalTemperatureFahrenheit = temp * 9 / 5 - 459.67;
                Double finalWindSpeedMetric = ws * 3.6;
                Double finalWindSpeedImperial = ws / 0.447046;
                long end = System.currentTimeMillis() - start;
                embed.setColor(Color.CYAN).setTitle(":flag_" + countryCode.toLowerCase() + ":" + " Forecast information for " + content, null).setDescription(status + " (" + cloudiness + "% clouds)").addField(":thermometer: Temperature", String.format("%d°C | %d°F", finalTemperatureCelsius.intValue(), finalTemperatureFahrenheit.intValue()), true).addField(":droplet: Humidity", humidity + "%", true).addBlankField(true).addField(":wind_blowing_face: Wind Speed", String.format("%dkm/h | %dmph", finalWindSpeedMetric.intValue(), finalWindSpeedImperial.intValue()), true).addField("Pressure", pressure + "hPA", true).addBlankField(true).setFooter("Information provided by OpenWeatherMap (Process time: " + end + "ms)", null);
                event.getChannel().sendMessage(embed.build()).queue();
            } catch (NullPointerException npe) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "Error while fetching results. (Not found?)").queue();
            } catch (Exception e) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "Error while fetching results. (Not found?)").queue();
                log.warn("Exception caught while trying to fetch weather data, maybe the API changed something?", e);
            }
        }

        @Override
        public MessageEmbed help(GuildMessageReceivedEvent event) {
            return helpEmbed(event, "Weather command").setDescription("This command retrieves information from OpenWeatherMap. Used to check **forecast information.**").addField("Usage", "`~>weather <city>,<countrycode>` - **Retrieves the forecast information for the given location.**", false).addField("Parameters", "`city` - **Your city name, e.g. New York, **\n" + "`countrycode` - **(OPTIONAL) The abbreviation for your country, for example US (USA) or MX (Mexico).**", false).addField("Example", "`~>weather New York, US`", false).build();
        }
    });
}
Also used : EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) MessageEmbed(net.dv8tion.jda.core.entities.MessageEmbed) SimpleCommand(net.kodehawa.mantarobot.core.modules.commands.SimpleCommand) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) UnsupportedEncodingException(java.io.UnsupportedEncodingException) WeatherData(net.kodehawa.mantarobot.commands.utils.WeatherData) Subscribe(com.google.common.eventbus.Subscribe)

Example 23 with SimpleCommand

use of net.kodehawa.mantarobot.core.modules.commands.SimpleCommand 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 24 with SimpleCommand

use of net.kodehawa.mantarobot.core.modules.commands.SimpleCommand 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 25 with SimpleCommand

use of net.kodehawa.mantarobot.core.modules.commands.SimpleCommand 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)

Aggregations

Subscribe (com.google.common.eventbus.Subscribe)39 SimpleCommand (net.kodehawa.mantarobot.core.modules.commands.SimpleCommand)39 GuildMessageReceivedEvent (net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent)37 MessageEmbed (net.dv8tion.jda.core.entities.MessageEmbed)25 EmoteReference (net.kodehawa.mantarobot.utils.commands.EmoteReference)17 MantaroData (net.kodehawa.mantarobot.data.MantaroData)16 CommandRegistry (net.kodehawa.mantarobot.core.CommandRegistry)15 Module (net.kodehawa.mantarobot.core.modules.Module)15 Category (net.kodehawa.mantarobot.core.modules.commands.base.Category)15 List (java.util.List)14 Utils (net.kodehawa.mantarobot.utils.Utils)14 EmbedBuilder (net.dv8tion.jda.core.EmbedBuilder)12 DBGuild (net.kodehawa.mantarobot.db.entities.DBGuild)12 TimeUnit (java.util.concurrent.TimeUnit)11 Player (net.kodehawa.mantarobot.db.entities.Player)11 DiscordUtils (net.kodehawa.mantarobot.utils.DiscordUtils)11 MantaroBot (net.kodehawa.mantarobot.MantaroBot)10 RateLimiter (net.kodehawa.mantarobot.utils.commands.RateLimiter)10 Collectors (java.util.stream.Collectors)9 User (net.dv8tion.jda.core.entities.User)9