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();
}
Aggregations