Search in sources :

Example 1 with Usability

use of com.freya02.botcommands.internal.Usability in project BotCommands by freya022.

the class HelpCommand method sendCommandHelp.

public void sendCommandHelp(BaseCommandEvent event, CommandPath cmdPath) {
    TextCommandCandidates cmds = event.getContext().findCommands(cmdPath);
    if (cmds == null) {
        event.respond("Command '" + getSpacedPath(cmdPath) + "' does not exist").queue(null, event.failureReporter("Failed to send help"));
        return;
    }
    final Member member = event.getMember();
    final GuildMessageChannel channel = event.getGuildChannel();
    final Usability usability = Usability.of(context, cmds.first(), member, channel, !context.isOwner(member.getIdLong()));
    if (usability.isNotShowable()) {
        event.respond("Command '" + getSpacedPath(cmdPath) + "' does not exist").queue(null, event.failureReporter("Failed to send help"));
        return;
    }
    final EmbedBuilder embed = getCommandHelpEmbed(event, cmds);
    event.respond(embed.build()).queue();
}
Also used : EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) Member(net.dv8tion.jda.api.entities.Member) Usability(com.freya02.botcommands.internal.Usability) GuildMessageChannel(net.dv8tion.jda.api.entities.GuildMessageChannel)

Aggregations

Usability (com.freya02.botcommands.internal.Usability)1 EmbedBuilder (net.dv8tion.jda.api.EmbedBuilder)1 GuildMessageChannel (net.dv8tion.jda.api.entities.GuildMessageChannel)1 Member (net.dv8tion.jda.api.entities.Member)1