use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class ListCCs method getUserCommands.
public String getUserCommands(CommandObject command, long userID) {
IUser user = Globals.getClient().getUserByID(userID);
int total = 0;
command.setAuthor(user);
int max = command.guild.customCommands.maxCCs(command.user, command.guild);
XEmbedBuilder builder = new XEmbedBuilder(command);
String title = "> Here are the custom commands for user: **@" + user.getName() + "#" + user.getDiscriminator() + "**.";
List<String> list = new ArrayList<>();
for (CCommandObject c : command.guild.customCommands.getCommandList()) {
if (c.getUserID() == userID) {
list.add(command.guild.config.getPrefixCC() + c.getName());
total++;
}
}
builder.withTitle(title);
String content = Utility.listFormatter(list, true);
if (content.length() > 2000) {
String path = Constants.DIRECTORY_TEMP + command.message.longID + ".txt";
FileHandler.writeToFile(path, content, false);
File file = new File(path);
RequestHandler.sendFile(title, file, command.channel.get());
return null;
}
builder.withDescription("```\n" + content + "```");
builder.withFooterText("Total Custom commands: " + total + "/" + max + ".");
RequestHandler.sendEmbedMessage("", builder, command.channel.get());
return null;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class ChannelStats method execute.
@Override
public String execute(String args, CommandObject command) {
XEmbedBuilder builder = new XEmbedBuilder(command);
builder.withTitle("Channel Stats");
ArrayList<String> channelTypes = new ArrayList<>();
ArrayList<String> channelSettings = new ArrayList<>();
if (args != null && !args.isEmpty()) {
for (ChannelSetting s : command.guild.channelSettings) {
if (s.toString().equalsIgnoreCase(args)) {
List<IChannel> channels = command.guild.getChannelsByType(s);
List<String> channelMentions = Utility.getChannelMentions(channels);
if (channels.size() != 0) {
builder.appendField(s.toString(), Utility.listFormatter(channelMentions, true), false);
RequestHandler.sendEmbedMessage("", builder, command.channel.get());
return null;
} else {
if (s.isSetting()) {
return "> Could not find any channels with the **" + s.toString() + "** setting enabled.";
} else {
return "> Could not find a channel with the **" + s.toString() + "** type enabled.";
}
}
}
}
return "> Could not any channel settings with that name.";
}
for (ChannelSettingObject c : command.guild.channelData.getChannelSettings()) {
if (c.getChannelIDs().contains(command.channel.longID)) {
for (ChannelSetting setting : Globals.getChannelSettings()) {
if (c.getType() == setting) {
if (setting.isSetting()) {
channelSettings.add(c.getType().toString());
} else {
channelTypes.add(c.getType().toString());
}
}
}
}
}
if (channelSettings.size() == 0 && channelTypes.size() == 0) {
return "> I found nothing of value.";
}
if (channelTypes.size() != 0) {
builder.appendField("Types:", Utility.listFormatter(channelTypes, true), false);
}
if (channelSettings.size() != 0) {
builder.appendField("Settings:", Utility.listFormatter(channelSettings, true), false);
}
RequestHandler.sendEmbedMessage("", builder, command.channel.get());
return null;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class InfoEditModes method listFiles.
public static String listFiles(CommandObject command) {
// send Embed
XEmbedBuilder builder = new XEmbedBuilder(command);
builder.withTitle("> Here are the files available to you:");
File imagDir = new File(Utility.getGuildImageDir(command.guild.longID));
File[] imageList = imagDir.listFiles();
ArrayList<String> fileNames = new ArrayList<>();
for (File f : imageList) {
fileNames.add(f.getName());
}
builder.withDesc("```\n" + Utility.listFormatter(fileNames, true) + "```");
RequestHandler.sendEmbedMessage("", builder, command.channel.get());
return null;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class HelpDM method execute.
@Override
public String execute(String args, CommandObject command) {
XEmbedBuilder builder = new XEmbedBuilder(command);
List<Command> commands = Utility.getCommandsByType(Globals.getAllCommands(), command, SAILType.DM, true);
List<String> list = new ArrayList<>();
for (Command c : commands) {
list.add(c.getCommand(command));
}
Collections.sort(list);
StringBuilder desc = new StringBuilder("**> Direct Message Commands.**```" + Utility.listFormatter(list, false) + "```\n");
desc.append(Utility.getCommandInfo(new InfoDM()));
builder.withDescription(desc.toString());
RequestHandler.sendEmbedMessage("", builder, command.channel.get());
return null;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class GetGuildList method execute.
@Override
public String execute(String args, CommandObject command) {
ArrayList<String> guilds = new ArrayList<>();
for (IGuild g : command.client.get().getGuilds()) {
guilds.add(g.getName() + ": " + g.getLongID());
}
XEmbedBuilder builder = new XEmbedBuilder(command);
Utility.listFormatterEmbed("List Of Guilds", builder, guilds, false);
command.user.sendEmbededDm("", builder);
return null;
}
Aggregations