use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class Command method getCommandInfo.
/**
* Creates a message used to fetch the command's documentations
*
* @param command
* @return
*/
public XEmbedBuilder getCommandInfo(CommandObject command) {
XEmbedBuilder infoEmbed = new XEmbedBuilder(command);
// command info
StringBuilder builder = new StringBuilder();
builder.append(description(command) + "\n");
builder.append("**Type: **" + type.toString() + ".");
// display permissions
if (perms != null && perms.length != 0) {
builder.append("\n**Perms: **");
ArrayList<String> permList = new ArrayList<>(perms.length);
for (Permissions p : perms) {
permList.add(Utility.enumToString(p));
}
builder.append(Utility.listFormatter(permList, true));
}
if (names.length > 1) {
List<String> aliases = Arrays.asList(names).stream().map(s -> command.guild.config.getPrefixCommand() + s).collect(Collectors.toList());
aliases.remove(0);
builder.append("\n**Aliases:** " + Utility.listFormatter(aliases, true));
}
List<SubCommandObject> objectList = subCommands.stream().filter(subCommandObject -> GuildHandler.testForPerms(command, subCommandObject.getPermissions())).collect(Collectors.toList());
if (objectList.size() != 0)
builder.append("\n" + Command.spacer);
infoEmbed.withTitle("> Help - " + names()[0]);
infoEmbed.appendField("**" + getUsage(command) + "** " + Command.spacer, builder.toString(), true);
for (SubCommandObject s : objectList) {
infoEmbed.appendField(s.getCommandUsage(command) + " " + Command.spacer, s.getHelpDesc(command), true);
}
// Handle channels
List<IChannel> channels = command.guild.getChannelsByType(channel);
List<String> channelMentions = Utility.getChannelMentions(channels);
// channel
if (channelMentions.size() > 0) {
if (channelMentions.size() == 1) {
infoEmbed.appendField("Channel ", Utility.listFormatter(channelMentions, true), false);
} else {
infoEmbed.appendField("Channels ", Utility.listFormatter(channelMentions, true), false);
}
}
return infoEmbed;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class GuildToggle method info.
public XEmbedBuilder info(CommandObject command) {
XEmbedBuilder builder = new XEmbedBuilder(command);
if (isModule()) {
builder.withTitle("Module - " + name());
} else {
builder.withTitle("Setting - " + name());
}
String fullDesc = desc(command);
if (statsOnInfo()) {
String stats = stats(command);
if (stats != null && !stats.isEmpty()) {
fullDesc += "\n\n**Stats:**\n" + stats;
}
}
builder.withDesc(fullDesc);
List<String> commandNames = commands.stream().map(command1 -> command1.getCommand(command)).collect(Collectors.toList());
commandNames.addAll(Globals.getAllCommands().stream().filter(command1 -> command1.type() == affectsType).map(command1 -> command1.getCommand(command)).collect(Collectors.toList()));
commandNames = commandNames.stream().distinct().collect(Collectors.toList());
List<SAILType> settingNames = settings.stream().map(guildSetting -> guildSetting.name()).collect(Collectors.toList());
List<ChannelSetting> channelNames = channels.stream().map(channelSetting -> channelSetting).collect(Collectors.toList());
if (commandNames.size() != 0) {
builder.appendField("Commands:", "```\n" + Utility.listFormatter(commandNames, true) + Command.spacer + "```", true);
}
if (settingNames.size() != 0) {
builder.appendField("Settings:", "```\n" + Utility.listEnumFormatter(settingNames, true) + Command.spacer + "```", true);
}
if (channelNames.size() != 0) {
builder.appendField("Channels:", "```\n" + Utility.listEnumFormatter(channelNames, true) + Command.spacer + "```", true);
}
StringBuilder footer = new StringBuilder();
if (isModule())
footer.append("Module ");
else
footer.append("Setting ");
if (enabled(command.guild.config))
footer.append("Enabled.");
else
footer.append("Disabled.");
builder.withFooterText(footer.toString());
return builder;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class SlashCommand method getCommandInfo.
@Override
public XEmbedBuilder getCommandInfo(CommandObject command) {
XEmbedBuilder builder = new XEmbedBuilder(command);
builder.withTitle(getCommand(command));
builder.withDescription(description(command));
if (names.length != 1) {
builder.appendField("Aliases:", Utility.listFormatter(Arrays.asList(names), true), true);
}
return builder;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class BotHelp method tags.
private String tags(CommandObject command) {
XEmbedBuilder builder = new XEmbedBuilder(command);
builder.withTitle("Tags.");
builder.withDesc("> Tags are strings of text that when added to CustomCommands, The info page generator, Daily Messages or Level up messages run specific code and change the output text.");
builder.send(command.channel);
return null;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class BotHelp method directMessages.
private String directMessages(CommandObject command) {
XEmbedBuilder builder = new XEmbedBuilder(command);
builder.withTitle("Direct messages.");
builder.withDesc("> When you send a non command Direct message to " + command.client.bot.displayName + " it will send it to the bot developer.");
builder.send(command.channel);
return null;
}
Aggregations