use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class ListServers method execute.
@Override
public String execute(String args, CommandObject command) {
if (command.guild.servers.getServers().size() == 0) {
return "> No servers have been listed yet, If you would like to list one yourself you can do so using **" + get(AddServer.class).getUsage(command) + "**.";
}
XEmbedBuilder builder = new XEmbedBuilder(command);
String title = "> Here are the Servers I have Listed:";
ArrayList<String> serverNames = command.guild.servers.getServers().stream().map(ServerObject::getName).collect(Collectors.toCollection(ArrayList::new));
Collections.sort(serverNames);
String suffix = Utility.getCommandInfo(new Server(), command);
Utility.listFormatterEmbed(title, builder, serverNames, false, suffix);
RequestHandler.sendEmbedMessage("", builder, command.channel.get());
return null;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class TopTen method execute.
@Override
public String execute(String args, CommandObject command) {
ArrayList<ProfileObject> ranks = new ArrayList<>();
ArrayList<String> response = new ArrayList<>();
for (ProfileObject u : command.guild.users.getProfiles()) {
long rank = PixelHandler.rank(command.guild.users, command.guild.get(), u.getUserID());
if (rank <= 10 && rank != -1) {
ranks.add(u);
}
}
Utility.sortUserObjects(ranks, false);
// format rank stats
for (ProfileObject r : ranks) {
IUser ranked = command.guild.getUserByID(r.getUserID());
String rankPos = "**" + PixelHandler.rank(command.guild.users, command.guild.get(), r.getUserID()) + "** - ";
StringBuilder toFormat = new StringBuilder(ranked.getDisplayName(command.guild.get()));
toFormat.append("\n " + indent + "`Level: " + r.getCurrentLevel() + ", Pixels: " + NumberFormat.getInstance().format(r.getXP()) + "`");
if (r.getUserID() == command.user.get().getLongID()) {
response.add(rankPos + spacer + "**" + toFormat + "**");
} else {
response.add(rankPos + toFormat);
}
}
XEmbedBuilder builder = new XEmbedBuilder(command);
builder.withTitle("Top Ten Users for the " + command.guild.get().getName() + " Server.");
builder.withDesc(Utility.listFormatter(response, false));
RequestHandler.sendEmbedMessage("", builder, command.channel.get());
return null;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class TopUserForRole method getEmbed.
private void getEmbed(CommandObject command, IRole role, List<Long> userIDs) {
XEmbedBuilder embed = new XEmbedBuilder(command);
int showing = (userIDs.size() > 5 ? 5 : userIDs.size());
embed.withTitle("Top " + (userIDs.size() == 1 ? " user" : showing + " users") + " for role " + role.getName());
embed.withFooterText("Total ranked users with this role: " + userIDs.size());
ProfileObject userProfile;
UserObject userObject;
NumberFormat nf = NumberFormat.getInstance();
String titlef = "#%s. %s";
String contentf = "**XP:** %s\t**Level:** %s\n**UID:** %s";
for (int i = 0; i < showing; i++) {
userProfile = command.guild.users.getUserByID(userIDs.get(i));
userObject = userProfile.getUser(command.guild);
embed.appendField(String.format(titlef, i + 1, userObject.displayName), String.format(contentf, nf.format(userProfile.getXP()), userProfile.getCurrentLevel(), userObject.longID), false);
}
embed.send(command.channel);
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class ListModifs method getList.
public static XEmbedBuilder getList(CommandObject command) {
String title = "> Here are the Modifier roles you can choose from:";
List<String> list = command.guild.getModifierRoles().stream().map(iRole -> iRole.getName()).collect(Collectors.toList());
XEmbedBuilder builder = new XEmbedBuilder(command);
builder.withTitle(title);
builder.withDesc("```\n" + Utility.listFormatter(list, true) + "```\n" + get(ModifierRoles.class).missingArgs(command));
return builder;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class ListRoles method getList.
public static XEmbedBuilder getList(CommandObject command) {
String title = "> Here are the Cosmetic roles you can choose from:";
List<String> list = command.guild.getCosmeticRoles().stream().map(iRole -> iRole.getName()).collect(Collectors.toList());
XEmbedBuilder builder = new XEmbedBuilder(command);
builder.withTitle(title);
builder.withDesc("```\n" + Utility.listFormatter(list, true) + "```\n" + get(CosmeticRoles.class).missingArgs(command));
return builder;
}
Aggregations