use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class ListJoinMessages method execute.
@Override
public String execute(String args, CommandObject command) {
XEmbedBuilder builder = new XEmbedBuilder(command);
StringHandler handler = new StringHandler();
List<JoinMessage> messages = command.guild.channelData.getJoinMessages();
if (messages.size() == 0) {
return "> No Messages exist right now, you can create some with **" + new NewJoinMessage().getUsage(command) + "**";
}
int page = 1;
try {
page = Integer.parseInt(args);
if (page <= 0)
return "> Invalid Page.";
} catch (NumberFormatException e) {
if (args != null && !args.isEmpty()) {
return "> Not a valid number";
}
}
page--;
List<String> pages = new LinkedList<>();
int index = 1;
int i = 0;
for (JoinMessage m : messages) {
if (i == 10) {
i = 0;
pages.add(handler.toString());
handler.emptyContent();
}
String shortNote = Utility.truncateString(Utility.removeFun(m.getContent()), 65);
handler.append("**> Message #" + index + "**");
handler.append("\n" + shortNote);
handler.append("\n");
i++;
index++;
}
pages.add(handler.toString());
if (page >= pages.size()) {
return "> Invalid Page.";
}
builder.withTitle("> Join Message list");
builder.withDesc(pages.get(page) + "\n\n" + missingArgs(command));
builder.withFooterText("Page " + (page + 1) + "/" + pages.size() + " | Total Join Messages: " + messages.size());
builder.send(command.channel);
return null;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class BotHelp method arguments.
private String arguments(CommandObject command) {
XEmbedBuilder builder = new XEmbedBuilder(command);
builder.withTitle("Arguments.");
builder.withDesc("> `[]` and `()` in the command usage are not needed and in most cases can cause the command to fail.\n" + "> `[]` brackets means that this argument is required.\n" + "> `()` brackets means that this argument is optional.\n" + "> When an argument ends in `...` it means you can input as many of this argument as you like.\n" + "> The `@User` argument means that you can either use a user ID, mention or the user's display name or username as an argument.\n" + "> The `Time` argument means that you can enter a number or a number ending in `d` for days, `h` for hours, `m` for minutes or `s` for seconds.");
builder.send(command.channel);
return null;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class BotHelp method defaultOutput.
private String defaultOutput(CommandObject command) {
XEmbedBuilder builder = new XEmbedBuilder(command);
builder.withTitle("Bot Help.");
builder.withDesc("**Modes:**\n" + "> **Arguments**\n" + "Gives you information about how to use command arguments.\n" + "> **DMs**\n" + "Gives you information about how Direct messages work for **" + command.client.bot.displayName + "**.\n" + "> **Tags**\n" + "Gives you information explaining what tags are.\n\n" + missingArgs(command));
builder.send(command.channel);
return null;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class GetGuildInfo method resetEmbed.
private XEmbedBuilder resetEmbed(XEmbedBuilder builder, IChannel channel, CommandObject command, int extraLength) {
if ((builder.getTotalVisibleCharacters() + extraLength) > 2000 || builder.getFieldCount() + 1 > EmbedBuilder.FIELD_COUNT_LIMIT) {
RequestHandler.sendEmbedMessage("", builder, channel).get();
builder = new XEmbedBuilder(command);
}
return builder;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class TagObject method getInfo.
public XEmbedBuilder getInfo(CommandObject command) {
XEmbedBuilder builder = new XEmbedBuilder(command);
builder.withTitle(name);
StringBuilder descContents = new StringBuilder();
descContents.append(desc);
if (isPassive()) {
descContents.append("\n\n**This tag cannot be used in commands and is passively run on every command.**");
} else if (requiredArgs != 0) {
descContents.append("\n**Usage:** " + "`" + prefix + usage + suffix + "`");
} else {
descContents.append("\n**Usage:** `" + name + "`");
}
descContents.append("\n\n**Types:** " + Utility.listEnumFormatter(types, true));
builder.withDesc(descContents.toString());
return builder;
}
Aggregations