From 7e57f2f56cc78be0d63b1c0809c34c7c5ed88d86 Mon Sep 17 00:00:00 2001 From: Salmonllama Date: Tue, 7 Sep 2021 19:26:16 -0400 Subject: [PATCH] Disabled color commands. --- .../fsbot/commands/general/ColorCommand.java | 47 ++----------------- .../fsbot/commands/general/ColorsCommand.java | 24 ++-------- .../fsbot/commands/staff/AddColorCommand.java | 20 ++------ 3 files changed, 9 insertions(+), 82 deletions(-) diff --git a/src/main/java/dev/salmonllama/fsbot/commands/general/ColorCommand.java b/src/main/java/dev/salmonllama/fsbot/commands/general/ColorCommand.java index c9ac0d5..9bcd6ad 100644 --- a/src/main/java/dev/salmonllama/fsbot/commands/general/ColorCommand.java +++ b/src/main/java/dev/salmonllama/fsbot/commands/general/ColorCommand.java @@ -5,13 +5,7 @@ package dev.salmonllama.fsbot.commands.general; -import dev.salmonllama.fsbot.config.BotConfig; -import dev.salmonllama.fsbot.database.controllers.ColorRoleController; import dev.salmonllama.fsbot.guthix.*; -import org.apache.logging.log4j.util.Strings; -import org.javacord.api.entity.server.Server; -import org.javacord.api.entity.user.User; - import java.util.Arrays; import java.util.List; @@ -25,43 +19,8 @@ public class ColorCommand extends Command { @Override public void onCommand(CommandContext ctx) { - // The color given will be the args. - // Check if args[0] is reset. If so, remove all color roles. - // Check if the given string is a current color role. - // Remove any color roles that the user has. - // Give the user the color role they specified - ctx.getServer().ifPresentOrElse(server -> { - String[] args = ctx.getArgs(); - if (server.getIdAsString().equals(BotConfig.HOME_SERVER)) { - if (args[0].equals("reset")) { - // Remove all color roles - removeColorRoles(ctx.getUser(), server); - } - - String color = Strings.join(Arrays.asList(args), ' '); - ColorRoleController.get(color).thenAcceptAsync(possibleColorRole -> possibleColorRole.ifPresentOrElse(colorRole -> { - // Remove all color roles - removeColorRoles(ctx.getUser(), server); - // Give the user the one they specified - addColorRole(ctx.getUser(), server, colorRole.getRoleId()); - }, () -> ctx.reply("That color does not exist"))); - } - }, () -> ctx.reply("This command can only be used in the fashionscape server")); - } - - private static void removeColorRoles(User user, Server server) { - ColorRoleController.getAll().thenAcceptAsync( - possibleRoles -> possibleRoles.ifPresent( - colorRoles -> colorRoles.forEach( - colorRole -> server.getRoleById(colorRole.getRoleId()).ifPresent( - role -> user.removeRole(role, "Removed color role") - ) - ) - ) - ); - } - - private static void addColorRole(User user, Server server, long roleId) { - server.getRoleById(roleId).ifPresent(role -> user.addRole(role, "Added color role")); + ctx.getApi().getOwner().thenAcceptAsync(owner -> { + ctx.reply("This command is no longer active. An alternative is currently being developed. For more information, please contact " + owner); + }); } } diff --git a/src/main/java/dev/salmonllama/fsbot/commands/general/ColorsCommand.java b/src/main/java/dev/salmonllama/fsbot/commands/general/ColorsCommand.java index 762003e..16e26d5 100644 --- a/src/main/java/dev/salmonllama/fsbot/commands/general/ColorsCommand.java +++ b/src/main/java/dev/salmonllama/fsbot/commands/general/ColorsCommand.java @@ -23,26 +23,8 @@ public class ColorsCommand extends Command { @Override public void onCommand(CommandContext ctx) { - // List available color roles - ctx.getServer().ifPresentOrElse(server -> { - if (server.getIdAsString().equals(BotConfig.HOME_SERVER)) { - ColorRoleController.getAll().thenAcceptAsync( - possibleColorRoles -> possibleColorRoles.ifPresentOrElse(colorRoles -> { - EmbedBuilder response = new EmbedBuilder() - .setTitle("Color roles") - .setFooter(String.format("Found %d roles", colorRoles.size())); - - colorRoles.forEach( - colorRole -> server.getRoleById(colorRole.getRoleId()).ifPresent( - role -> response.addField(colorRole.getColor(), role.getMentionTag(), true) - ) - ); - - ctx.reply(response); - }, () -> ctx.reply("No color roles have been found"))); - } else { - ctx.reply("This command can only be used in the fashionscape server"); - } - }, () -> ctx.reply("This command can only be used in the fashionscape server")); + ctx.getApi().getOwner().thenAcceptAsync(owner -> { + ctx.reply("This command is no longer active. An alternative is currently being developed. For more information, please contact " + owner); + }); } } diff --git a/src/main/java/dev/salmonllama/fsbot/commands/staff/AddColorCommand.java b/src/main/java/dev/salmonllama/fsbot/commands/staff/AddColorCommand.java index 8ff0c0e..9cf98b2 100644 --- a/src/main/java/dev/salmonllama/fsbot/commands/staff/AddColorCommand.java +++ b/src/main/java/dev/salmonllama/fsbot/commands/staff/AddColorCommand.java @@ -24,22 +24,8 @@ public class AddColorCommand extends Command { @Override public void onCommand(CommandContext ctx) { - // Command takes only a role mention. - ctx.getServer().ifPresentOrElse(server -> { - if (server.getIdAsString().equals(BotConfig.HOME_SERVER)) { - List roles = ctx.getMessage().getMentionedRoles(); - roles.forEach(role -> { - ColorRole colorRole = new ColorRole.ColorRoleBuilder(role.getId()) - .setColor(role.getName()) - .setServerId(server.getId()) - .build(); - - ColorRoleController.insert(colorRole); - ctx.reply("Added color role:" + colorRole.toString()); - }); - } else { - ctx.reply("This command can only be used in the fashionscape server"); - } - }, () -> ctx.reply("This command can only be used in the fashionscape server")); + ctx.getApi().getOwner().thenAcceptAsync(owner -> { + ctx.reply("This command is no longer active. An alternative is currently being developed. For more information, please contact " + owner); + }); } }