Search in sources :

Example 6 with FormatterVariable

use of com.sx4.bot.formatter.function.FormatterVariable in project Sx4 by sx4-discord-bot.

the class AntiRegexCommand method formatters.

@Command(value = "formatters", aliases = { "format", "formatting" }, description = "Get all the formatters for anti regex you can use")
@CommandId(468)
@Examples({ "anti regex formatters" })
@BotPermissions(permissions = { Permission.MESSAGE_EMBED_LINKS })
public void formatters(Sx4CommandEvent event) {
    EmbedBuilder embed = new EmbedBuilder().setAuthor("Anti-Regex Formatters", null, event.getSelfUser().getEffectiveAvatarUrl());
    FormatterManager manager = FormatterManager.getDefaultManager();
    StringJoiner content = new StringJoiner("\n");
    for (FormatterVariable<?> variable : manager.getVariables(User.class)) {
        content.add("`{user." + variable.getName() + "}` - " + variable.getDescription());
    }
    for (FormatterVariable<?> variable : manager.getVariables(TextChannel.class)) {
        content.add("`{channel." + variable.getName() + "}` - " + variable.getDescription());
    }
    content.add("`{regex.id}` - Gets the id of the regex");
    content.add("`{regex.action.name}` - Gets the mod action name if one is set");
    content.add("`{regex.action.exists}` - Returns true or false if an action exists");
    content.add("`{regex.attempts.current}` - Gets the current attempts for the user");
    content.add("`{regex.attempts.max}` - Gets the max attempts set for the anti regex");
    embed.setDescription(content.toString());
    event.reply(embed.build()).queue();
}
Also used : FormatterManager(com.sx4.bot.formatter.FormatterManager) EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) StringJoiner(java.util.StringJoiner) BotPermissions(com.sx4.bot.annotations.command.BotPermissions) Command(com.jockie.bot.core.command.Command) Sx4Command(com.sx4.bot.core.Sx4Command) CommandId(com.sx4.bot.annotations.command.CommandId) Examples(com.sx4.bot.annotations.command.Examples)

Example 7 with FormatterVariable

use of com.sx4.bot.formatter.function.FormatterVariable in project Sx4 by sx4-discord-bot.

the class StarboardCommand method formatters.

@Command(value = "formatters", aliases = { "format", "formatting" }, description = "Get all the formatters for starboard you can use")
@CommandId(444)
@Examples({ "starboard formatters" })
@BotPermissions(permissions = { Permission.MESSAGE_EMBED_LINKS })
public void formatters(Sx4CommandEvent event) {
    EmbedBuilder embed = new EmbedBuilder().setAuthor("Starboard Formatters", null, event.getSelfUser().getEffectiveAvatarUrl());
    FormatterManager manager = FormatterManager.getDefaultManager();
    StringJoiner content = new StringJoiner("\n");
    for (FormatterVariable<?> variable : manager.getVariables(User.class)) {
        content.add("`{user." + variable.getName() + "}` - " + variable.getDescription());
    }
    for (FormatterVariable<?> variable : manager.getVariables(Member.class)) {
        content.add("`{member." + variable.getName() + "}` - " + variable.getDescription());
    }
    for (FormatterVariable<?> variable : manager.getVariables(Guild.class)) {
        content.add("`{server." + variable.getName() + "}` - " + variable.getDescription());
    }
    for (FormatterVariable<?> variable : manager.getVariables(TextChannel.class)) {
        content.add("`{channel." + variable.getName() + "}` - " + variable.getDescription());
    }
    for (FormatterVariable<?> variable : manager.getVariables(ReactionEmote.class)) {
        content.add("`{emote." + variable.getName() + "}` - " + variable.getDescription());
    }
    content.add("`{stars}` - Gets amount of stars the starboard has");
    content.add("`{stars.next}` - Gets the amount of stars the next milestone requires");
    content.add("`{stars.next.until}` - Gets the amount of stars needed to reach the next milestone");
    content.add("`{id}` - Gets the id for the starboard");
    embed.setDescription(content.toString());
    event.reply(embed.build()).queue();
}
Also used : FormatterManager(com.sx4.bot.formatter.FormatterManager) EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) StringJoiner(java.util.StringJoiner) Command(com.jockie.bot.core.command.Command) Sx4Command(com.sx4.bot.core.Sx4Command)

Aggregations

Sx4Command (com.sx4.bot.core.Sx4Command)7 FormatterManager (com.sx4.bot.formatter.FormatterManager)7 EmbedBuilder (net.dv8tion.jda.api.EmbedBuilder)7 Command (com.jockie.bot.core.command.Command)6 StringJoiner (java.util.StringJoiner)5 BotPermissions (com.sx4.bot.annotations.command.BotPermissions)2 CommandId (com.sx4.bot.annotations.command.CommandId)2 Examples (com.sx4.bot.annotations.command.Examples)2 Argument (com.jockie.bot.core.argument.Argument)1 ModuleCategory (com.sx4.bot.category.ModuleCategory)1 Sx4CommandEvent (com.sx4.bot.core.Sx4CommandEvent)1 FormatterFunction (com.sx4.bot.formatter.function.FormatterFunction)1 FormatterVariable (com.sx4.bot.formatter.function.FormatterVariable)1 PagedResult (com.sx4.bot.paged.PagedResult)1 Method (java.lang.reflect.Method)1 Parameter (java.lang.reflect.Parameter)1 Arrays (java.util.Arrays)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1