use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class WhatsMyColour method execute.
@Override
public String execute(String args, CommandObject command) {
UserObject user = command.user;
if (args != null && !args.isEmpty()) {
user = Utility.getUser(command, args, true, false);
if (user == null)
return "> Could not find user.";
}
boolean notAuthor = user.longID != command.user.longID;
Color color = user.getRandomColour();
XEmbedBuilder builder = new XEmbedBuilder(color);
String desc = notAuthor ? "**" + user.displayName + "'s** " : "Your ";
if (isAlias(command, names[2]) || isAlias(command, names[3])) {
desc += "color is : ";
} else {
desc += "colour is : ";
}
desc += "**#" + Integer.toHexString(color.getRGB()).substring(2).toUpperCase() + "**";
builder.withDescription(desc);
builder.send(command.channel);
return null;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class UserSettings method sendList.
private String sendList(String prefix, ProfileObject profile, CommandObject command, UserObject user, boolean showCommand) {
List<String> userSettings = new ArrayList<>();
for (UserSetting s : profile.getSettings()) {
userSettings.add(s.toString());
}
XEmbedBuilder builder = new XEmbedBuilder(command);
builder.withTitle(user.displayName + "'s User settings:");
if (userSettings.size() == 0) {
return "> **" + user.displayName + "** has no settings on their profile.";
} else {
String desc = "```\n" + Utility.listFormatter(userSettings, true) + "```";
if (showCommand) {
desc += "\n" + Utility.getCommandInfo(this, command);
}
builder.withDesc(desc);
}
RequestHandler.sendEmbedMessage(prefix, builder, command.channel.get());
return "";
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class StartUpGuide method execute.
@Override
public String execute(String args, CommandObject command) {
XEmbedBuilder builder = new XEmbedBuilder(command);
builder.withAuthorName("Start Up Guide.");
builder.withTitle("Helpful Commands.");
String desc = "**" + new Commands().getUsage(command) + "**\n" + "Lists all commands.\n**" + get(Help.class).getUsage(command) + "**\n" + "Gives you information about a command.\n**" + get(Module.class).getUsage(command) + "**\n" + "Lists all available modules and allows you to toggle them.\n**" + get(HelpModules.class).getUsage(command) + "**\n" + "Gives you information about a module.\n**" + get(Toggle.class).getUsage(command) + "**\n" + "Lists all available settings and allows you to toggle them.\n**" + get(HelpSettings.class).getUsage(command) + "**\n" + "Gives you information about a setting.\n**" + get(ChannelHere.class).getUsage(command) + "**\n" + "Lists all available channel settings/types and allows you to toggle them.\n**" + get(HelpChannel.class).getUsage(command) + "**\n" + "Gives you information about a channel setting/type.\n**" + get(ListTags.class).getUsage(command) + "**\n" + "Lists all tags available for use in customCommand, Info, Daily and LevelUp messages.\n**" + get(HelpTags.class).getUsage(command) + "**\n" + "Gives you information about a tag.\n**" + get(GetGuildInfo.class).getUsage(command) + "**\n" + "Gives you information about this server's setup.\n**" + get(BotInfo.class).getUsage(command) + "**\n" + "Gives you information about this bot.\n**" + get(BotHelp.class).getUsage(command) + "**\n" + "Gives you information about various bot features.";
builder.withDesc(desc);
RequestHandler.sendEmbedMessage("", builder, command.channel.get());
return null;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class JoinMessageInfo method execute.
@Override
public String execute(String args, CommandObject command) {
int index;
List<JoinMessage> messages = command.guild.channelData.getJoinMessages();
XEmbedBuilder builder = new XEmbedBuilder(command);
try {
index = Integer.parseInt(args);
} catch (NumberFormatException e) {
return "> Not a valid number.";
}
index--;
if (index < 0 || index >= messages.size()) {
return "> Could not find message.";
}
JoinMessage message = messages.get(index);
builder.withTitle("Message #" + (index + 1));
builder.withDesc(message.getContent());
UserObject user = new UserObject(message.getCreator(), command.guild);
if (user.get() == null) {
builder.withFooterText("Could not find user.");
} else {
builder.withFooterText("Creator: @" + user.username);
builder.withFooterIcon(user.getAvatarURL());
}
builder.send(command.channel);
return null;
}
use of com.github.vaerys.objects.XEmbedBuilder in project DiscordSailv2 by Vaerys-Dawn.
the class ManagePixelRoles method execute.
@Override
public String execute(String args, CommandObject command) {
if (args.equalsIgnoreCase("list")) {
XEmbedBuilder builder = new XEmbedBuilder(command);
builder.withTitle("Pixel Roles");
IRole xpDenied = command.guild.getXPDeniedRole();
IRole topTen = command.guild.getTopTenRole();
List<RewardRoleObject> rewardRoles = command.guild.config.getRewardRoles();
if (xpDenied == null && topTen == null && rewardRoles.size() == 0) {
return "> No roles are set up.\n" + missingArgs(command);
}
String desc = "";
if (rewardRoles.size() != 0) {
desc += "**Reward Roles**";
for (RewardRoleObject r : rewardRoles) {
desc += "\n> **" + command.guild.getRoleByID(r.getRoleID()).getName() + "** -> Level: **" + r.getLevel() + "**";
}
desc += "\n\n";
}
if (topTen != null) {
desc += "**Top Ten Role**: " + topTen.getName() + "\n\n";
}
if (xpDenied != null) {
desc += "**Pixel Denied Role**: " + xpDenied.getName();
}
builder.withDesc(desc);
builder.send(command.channel);
return null;
}
SplitFirstObject mode = new SplitFirstObject(args);
IRole role = GuildHandler.getRoleFromName(mode.getRest(), command.guild.get());
if (role == null) {
return "> **" + mode.getRest() + "** is not a valid Role name.";
}
try {
long level = Long.parseLong(mode.getFirstWord());
if (level > 256 || level <= 0) {
return "> Level must be between 1-256.";
}
for (RewardRoleObject r : command.guild.config.getRewardRoles()) {
if (r.getLevel() == level) {
return "> That level already has a reward set.";
}
if (r.getRoleID() == role.getLongID()) {
r.setLevel(level);
return "> Level to obtain **" + role.getName() + "** is now set to level **" + level + "**.";
}
}
command.guild.config.getRewardRoles().add(new RewardRoleObject(role.getLongID(), level));
return "> The role **" + role.getName() + "** will now be awarded at level **" + level + "**.";
} catch (NumberFormatException e) {
switch(mode.getFirstWord().toLowerCase()) {
case "xpdenied":
for (RewardRoleObject r : command.guild.config.getRewardRoles()) {
if (r.getRoleID() == role.getLongID()) {
return "> **" + role.getName() + "** is already set as a reward role.";
}
}
if (role.getLongID() == command.guild.config.topTenRoleID) {
return "> **" + role.getName() + "** is already set as the server's TopTen role.";
}
command.guild.config.xpDeniedRoleID = role.getLongID();
return "> **" + role.getName() + "** is now the server's XpDenied role.";
case "topten":
for (RewardRoleObject r : command.guild.config.getRewardRoles()) {
if (r.getRoleID() == role.getLongID()) {
return "> **" + role.getName() + "** is already set as a reward role.";
}
}
if (role.getLongID() == command.guild.config.xpDeniedRoleID) {
return "> **" + role.getName() + "** is already set as the server's xpDenied role.";
}
command.guild.config.topTenRoleID = role.getLongID();
return "> **" + role.getName() + "** is now the server's TopTen role.";
case "remove":
if (role.getLongID() == command.guild.config.xpDeniedRoleID) {
command.guild.config.xpDeniedRoleID = -1;
return "> **" + role.getName() + "** is no longer the server's xpDenied role.";
} else if (role.getLongID() == command.guild.config.topTenRoleID) {
command.guild.config.topTenRoleID = -1;
return "> **" + role.getName() + "** is no longer the server's Top Ten role.";
}
for (RewardRoleObject r : command.guild.config.getRewardRoles()) {
if (r.getRoleID() == role.getLongID()) {
command.guild.config.getRewardRoles().remove(r);
return "> **" + role.getName() + "** is no longer set as a reward role.";
}
}
return "> **" + role.getName() + "** is not a valid Pixel role.";
default:
return "> Invalid Mode.\n" + modes + Utility.getCommandInfo(this, command);
}
}
}
Aggregations