Search in sources :

Example 36 with CommandException

use of uwu.narumi.tama.command.CommandException in project TamaBot by Loli-Cafe.

the class HandJobCommand method compose.

@Override
public void compose(MessageReceivedEvent event, String... args) {
    checkContext(event.getMember(), event.getTextChannel());
    if (!DiscordHelper.hasMention(event, Message.MentionType.USER))
        throw new CommandException(getUsage());
    event.getTextChannel().sendMessageEmbeds(execute(String.format("%s gave %s handjob", event.getAuthor().getAsMention(), DiscordHelper.getMention(event, Message.MentionType.USER).getAsMention()))).queue();
}
Also used : CommandException(uwu.narumi.tama.command.CommandException)

Example 37 with CommandException

use of uwu.narumi.tama.command.CommandException in project TamaBot by Loli-Cafe.

the class HandJobCommand method compose.

@Override
public void compose(SlashCommandInteractionEvent event) {
    checkContext(event.getMember(), event.getTextChannel());
    OptionMapping optionMapping = event.getOption("user");
    if (optionMapping == null)
        throw new CommandException(getUsage());
    event.replyEmbeds(execute(String.format("%s gave %s handjob", event.getUser().getAsMention(), optionMapping.getAsUser().getAsMention()))).queue();
}
Also used : OptionMapping(net.dv8tion.jda.api.interactions.commands.OptionMapping) CommandException(uwu.narumi.tama.command.CommandException)

Example 38 with CommandException

use of uwu.narumi.tama.command.CommandException in project TamaBot by Loli-Cafe.

the class LickNipplesCommand method compose.

@Override
public void compose(MessageReceivedEvent event, String... args) {
    checkContext(event.getMember(), event.getTextChannel());
    if (!DiscordHelper.hasMention(event, Message.MentionType.USER))
        throw new CommandException(getUsage());
    event.getTextChannel().sendMessageEmbeds(execute(String.format("%s licked %s nipples", event.getAuthor().getAsMention(), DiscordHelper.getMention(event, Message.MentionType.USER).getAsMention()))).queue();
}
Also used : CommandException(uwu.narumi.tama.command.CommandException)

Example 39 with CommandException

use of uwu.narumi.tama.command.CommandException in project TamaBot by Loli-Cafe.

the class StepCommand method compose.

@Override
public void compose(SlashCommandInteractionEvent event) {
    OptionMapping optionMapping = event.getOption("user");
    if (optionMapping == null)
        throw new CommandException(getUsage());
    event.replyEmbeds(execute(String.format("%s stepped at %s", event.getUser().getAsMention(), optionMapping.getAsUser().getAsMention()))).queue();
}
Also used : OptionMapping(net.dv8tion.jda.api.interactions.commands.OptionMapping) CommandException(uwu.narumi.tama.command.CommandException)

Example 40 with CommandException

use of uwu.narumi.tama.command.CommandException in project TamaBot by Loli-Cafe.

the class LevelingCommand method compose.

/*
        TODO: Make better handling for this type of commands
     */
@Override
public void compose(MessageReceivedEvent event, String... args) {
    checkContext(event.getMember(), event.getTextChannel());
    Tama.INSTANCE.getGuildManager().findGuild(Objects.requireNonNull(event.getGuild()).getId()).thenAccept(guild -> {
        if (guild == null)
            handleException(event, new CommandException("Can't fetch guild"));
        if (args.length > 0) {
            TextChannel textChannel;
            if (!event.getMessage().getMentionedChannels().isEmpty())
                textChannel = event.getMessage().getMentionedChannels().get(0);
            else
                textChannel = event.getTextChannel();
            if (guild.getBlacklistedLevelingChannels().contains(textChannel.getId())) {
                guild.getBlacklistedLevelingChannels().remove(textChannel.getId());
                event.getTextChannel().sendMessageEmbeds(EmbedHelper.success(String.format("Leveling on %s is now %s", textChannel.getAsMention(), "enabled"))).queue();
            } else {
                guild.getBlacklistedLevelingChannels().add(textChannel.getId());
                event.getTextChannel().sendMessageEmbeds(EmbedHelper.success(String.format("Leveling on %s is now %s", textChannel.getAsMention(), "disabled"))).queue();
            }
        } else {
            guild.setLeveling(!guild.isLeveling());
            event.getTextChannel().sendMessageEmbeds(EmbedHelper.success("Leveling on this server was: " + (guild.isLeveling() ? "enabled" : "disabled"))).queue();
        }
    });
}
Also used : TextChannel(net.dv8tion.jda.api.entities.TextChannel) CommandException(uwu.narumi.tama.command.CommandException)

Aggregations

CommandException (uwu.narumi.tama.command.CommandException)86 OptionMapping (net.dv8tion.jda.api.interactions.commands.OptionMapping)44 TextChannel (net.dv8tion.jda.api.entities.TextChannel)10 Role (net.dv8tion.jda.api.entities.Role)2