diff --git a/src/main/java/Controller/AntiSpam.java b/src/main/java/Controller/AntiSpam.java deleted file mode 100644 index 80b252c..0000000 --- a/src/main/java/Controller/AntiSpam.java +++ /dev/null @@ -1,43 +0,0 @@ -import java.util.HashMap; -import java.util.Map; - -import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; -public class AntiSpam { - - // Map to store user IDs and their last request timestamp - private final Map userRequestMap; - - // Time frame for rate limiting (in milliseconds) - private final long timeFrame; - - // Maximum number of requests allowed within the time frame - private final int maxRequests; - - public AntiSpam(long timeFrame, int maxRequests) { - userRequestMap = new HashMap<>(); - this.timeFrame = timeFrame; - this.maxRequests = maxRequests; - } - - public boolean checkSpam(SlashCommandInteractionEvent event) { - String userId = event.getUser().getId(); - - // Check if the user has reached the maximum number of requests - Long lastRequestTime = userRequestMap.get(userId); - if (lastRequestTime != null && System.currentTimeMillis() - lastRequestTime < timeFrame) { - int numRequests = 0; - for (long timestamp : userRequestMap.values()) { - if (System.currentTimeMillis() - timestamp < timeFrame) { - numRequests++; - } - } - if (numRequests >= maxRequests) { - return true; - } - } - - // Update the user's request timestamp - userRequestMap.put(userId, System.currentTimeMillis()); - return false; - } -} diff --git a/src/main/java/Controller/BroadcastLichess.java b/src/main/java/Controller/BroadcastLichess.java deleted file mode 100644 index 3bbbf06..0000000 --- a/src/main/java/Controller/BroadcastLichess.java +++ /dev/null @@ -1,45 +0,0 @@ -import chariot.Client; -import chariot.model.Broadcast; -import chariot.model.Many; -import net.dv8tion.jda.api.EmbedBuilder; - -import java.awt.*; -import java.util.List; - -public class BroadcastLichess { - - private final Client client; - private EmbedBuilder embedBuilder; - private String broadURL; - - - - public BroadcastLichess(Client client){ - this.broadURL = ""; - this.client = client; - - } - - - public EmbedBuilder getBroadData(){ - Many broadcastMany = this.client.broadcasts().official(); - List broadcasts = broadcastMany.stream().toList(); - String name = broadcasts.get(0).tour().name(); - String des = broadcasts.get(0).tour().description(); - this.broadURL = broadcasts.get(0).tour().url(); - this.embedBuilder = new EmbedBuilder(); - this.embedBuilder.setColor(Color.green); - this.embedBuilder.setTitle(name); - this.embedBuilder.setDescription(des); - this.embedBuilder.addField("View Tournament:", this.broadURL, true); - this.embedBuilder.setThumbnail("https://static-00.iconduck.com/assets.00/lichess-icon-512x512-q0oh5bwk.png"); - return embedBuilder; - } - - - - - - - -} diff --git a/src/main/java/Controller/CCProfile.java b/src/main/java/Controller/CCProfile.java deleted file mode 100644 index 04b536f..0000000 --- a/src/main/java/Controller/CCProfile.java +++ /dev/null @@ -1,73 +0,0 @@ -import io.github.sornerol.chess.pubapi.client.PlayerClient; -import io.github.sornerol.chess.pubapi.client.StreamersClient; -import io.github.sornerol.chess.pubapi.client.TournamentClient; -import io.github.sornerol.chess.pubapi.domain.game.ArchiveGame; -import io.github.sornerol.chess.pubapi.domain.player.Player; -import io.github.sornerol.chess.pubapi.domain.player.stats.PlayerStats; -import io.github.sornerol.chess.pubapi.exception.ChessComPubApiException; -import net.dv8tion.jda.api.EmbedBuilder; -import java.time.LocalDate; -import java.awt.*; -import java.io.IOException; -import java.util.List; - -public class CCProfile { - - private String username; - private EmbedBuilder embedBuilder; - private PlayerClient playerClient; - - - - public CCProfile(String username){ - this.username = username.toLowerCase().trim(); - } - - - - public EmbedBuilder getCCProfile(){ - - - try { - - - this.playerClient = new PlayerClient(); - - playerClient.setUserAgent("your_app; username: your_username; contact: your_email"); - this.embedBuilder = new EmbedBuilder(); - String proSay = ""; - String say = ""; - - - - PlayerStats player = playerClient.getStatsForPlayer(this.username); - - proSay+= " ** Bullet**: " + - player.getChessBullet().getLast().getRating().intValue() + - "\n **Rapid:** " + - player.getChessRapid().getLast().getRating().intValue() + - "\n **Blitz:** " + - player.getChessBlitz().getLast().getRating().intValue() + - "\n **PuzzleRush:** " + - player.getPuzzleRush().getBest().getScore().intValue(); - this.embedBuilder.setThumbnail("https://images.chesscomfiles.com/uploads/v1/images_users/tiny_mce/SamCopeland/phpmeXx6V.png").setTitle(username + "'s Chess.com Profile").setDescription(proSay).setColor(Color.green); - - - - - } catch (IOException e) { - return this.embedBuilder.setDescription("error! Please provide a valid username!").setColor(Color.red); - } catch (ChessComPubApiException e) { - return this.embedBuilder.setDescription("loading!"); - } - - return this.embedBuilder; - - } - - - - - - -} diff --git a/src/main/java/Controller/ChessUtil.java b/src/main/java/Controller/ChessUtil.java deleted file mode 100644 index 543a2c2..0000000 --- a/src/main/java/Controller/ChessUtil.java +++ /dev/null @@ -1,33 +0,0 @@ - -import com.github.bhlangonijr.chesslib.Board; - -public class ChessUtil { - - private Board board; - - public ChessUtil(){ - - this.board = new Board(); - - } - - - public String getImageFromFEN(String fen){ - try{ - String img = ""; - this.board.loadFromFen(fen); - String[] getImgCord = this.board.getFen().split(" "); - img += "https://lichess1.org/export/fen.gif?fen=" + getImgCord[0] + "&theme=blue&piece=alpha"; - return img; - - }catch(Exception e){ - return "Please provide a valid FEN!"; - } - - - - } - - - -} diff --git a/src/main/java/Controller/CommandHandler.java b/src/main/java/Controller/CommandHandler.java deleted file mode 100644 index 7645836..0000000 --- a/src/main/java/Controller/CommandHandler.java +++ /dev/null @@ -1,676 +0,0 @@ -import chariot.Client; -import com.github.bhlangonijr.chesslib.Board; -import lombok.SneakyThrows; -import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.events.guild.GuildJoinEvent; -import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent; -import net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent; -import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; -import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent; -import net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionEvent; -import net.dv8tion.jda.api.hooks.ListenerAdapter; -import net.dv8tion.jda.api.interactions.components.ActionRow; -import net.dv8tion.jda.api.interactions.components.buttons.Button; -import net.dv8tion.jda.api.interactions.components.selections.StringSelectMenu; -import net.dv8tion.jda.api.interactions.components.text.TextInput; -import net.dv8tion.jda.api.interactions.components.text.TextInputStyle; -import net.dv8tion.jda.api.interactions.modals.Modal; -import org.jetbrains.annotations.NotNull; - -import java.awt.*; - -public class CommandHandler extends ListenerAdapter { - - private final AntiSpam spam = new AntiSpam(300000, 1); - private final AntiSpam dailySpam = new AntiSpam(86400000, 1); - private final AntiSpam watchLimit = new AntiSpam(86400000, 24); - private String ButtonUserId; - private Board board = new Board(); - private Client ButtonClient; - private static final Client client = Client.basic(conf -> conf.retries(0)); - - public CommandHandler(){ - - } - - @Override - public void onMessageContextInteraction(MessageContextInteractionEvent event) { - - switch (event.getName()) { - case "Lichess Daily Puzzle" -> { - DailyCommand dailyCommand = new DailyCommand(client); - event.replyEmbeds(new EmbedBuilder().setColor(Color.cyan).setTitle("Daily Puzzle").setImage(dailyCommand.getPuzzle()).build()).addActionRow(net.dv8tion.jda.api.interactions.components.buttons.Button.link(dailyCommand.getPuzzleURL(), dailyCommand.getPuzzleSideToMove() + "| " + "Rating: " + dailyCommand.getRating()), net.dv8tion.jda.api.interactions.components.buttons.Button.primary("sol", "Solution"), net.dv8tion.jda.api.interactions.components.buttons.Button.success("hint", "Hint")).queue(); - } - case "Play Chess" -> { - event.reply("**⚔️ Please Pick Your Game's Mode **" + "\n\n").addActionRow( - net.dv8tion.jda.api.interactions.components.buttons.Button.success("casmode", "Casual"), net.dv8tion.jda.api.interactions.components.buttons.Button.danger("ratedmode", "Rated"), net.dv8tion.jda.api.interactions.components.buttons.Button.primary("enginemode", "Play BOT"), net.dv8tion.jda.api.interactions.components.buttons.Button.link("https://lichess.org/login", "Login/Register"), net.dv8tion.jda.api.interactions.components.buttons.Button.secondary("playhelp", "❓ Help")).queue(); - } - case "View Lichess Broadcasts" -> { - BroadcastLichess broadcast = new BroadcastLichess(client); - event.replyEmbeds(broadcast.getBroadData().build()).queue(); - } - case "Watch GMs" -> { - WatchMaster watchMaster = new WatchMaster(client); - event.deferReply(true).queue(); - event.getChannel().sendMessage(watchMaster.getMasterGames()).addActionRow(Button.link("https://lichess.org" + watchMaster.getGameId()[1], "Analyze")).queue(); - } - case "Chess.com Daily Puzzle" -> { - DailyCommandCC daily = new DailyCommandCC(); - event.deferReply(true).queue(); - event.getChannel().sendMessageEmbeds(new EmbedBuilder().setColor(Color.magenta).setTitle("Chess.com Daily Puzzle").setImage(daily.getPuzzle()).setFooter("Click on URL for solution").build()).addActionRow(Button.link(daily.getPuzzleURL(), daily.getPuzzleSideToMove())).queue(); - } - } - - } - - - @SneakyThrows - public void onSlashCommandInteraction(SlashCommandInteractionEvent event){ - String name = event.getName(); - - this.ButtonClient = client; - - - switch (name) { - case "answer" -> { - DailyCommand puzzleC = new DailyCommand(client); - if (puzzleC.checkSolution(event.getOption("daily-puzzle-answer").getAsString())) { - event.reply("You have solved the daily puzzle!").queue(); - } else { - event.reply("You failed solving daily puzzle try again!").queue(); - } - } - case "resetboard" -> { - this.board.loadFromFen(new Board().getFen()); - event.reply("board is reset!").queue(); - } - case "move" -> { - try { - - LiseChessEngine engine = new LiseChessEngine(this.board); - String makemove = event.getOption("play-move").getAsString(); - EmbedBuilder embedBuilder = new EmbedBuilder(); - - if (engine.gameOver()) { - event.reply("game over!").queue(); - engine.resetBoard(); - this.board = new Board(); - } - - this.board.doMove(makemove); - - engine.playDiscordBotMoves(); - embedBuilder.setColor(Color.green); - embedBuilder.setImage(engine.getImageOfCurrentBoard()); - embedBuilder.setFooter("White to move"); - event.getChannel().sendMessageEmbeds(embedBuilder.build()).queue(); - event.replyEmbeds(embedBuilder.build()).addActionRow(Button.danger("bot-lose", "Resign"), Button.secondary("bot-draw", "Draw")).setEphemeral(true).queue(); - - - } catch (Exception e) { - - event.reply("Not valid move! \n\n **If you are trying to castle use Captial letters (O-O & O-O-O)** \n\n (If you are running this command first time) The game is already on in other server, please reset the board with **/resetboard**! If you would like a to save your game, please join supprot server with **/invite**").setEphemeral(true).queue(); - - } - } - case "suggest" -> { - String sug = event.getOption("suggestid").getAsString(); - event.reply("thanks for feedback! Developer will look into it!").queue(); - } - case "community" -> { - EmbedBuilder embedBuilder = new EmbedBuilder(); - embedBuilder.setThumbnail("https://static-00.iconduck.com/assets.00/lichess-icon-512x512-q0oh5bwk.png"); - embedBuilder.setTitle("Best Chess Community To Learn/Play Chess"); - embedBuilder.setColor(Color.blue); - embedBuilder.setDescription("**lichess.org** [**Join**](https://discord.gg/lichess)" + "\n\n **Chess.com** [**Join**](https://discord.gg/chesscom)" + - "\n\n **The Pawn Zone** [**Join**](https://discord.gg/6aKNP3t) \n\n **The Moon Club** [**Join**](https://discord.gg/hK8Ru57SKd)"); - event.replyEmbeds(embedBuilder.build()).queue(); - } - case "broadcast" -> { - BroadcastLichess broadcast = new BroadcastLichess(client); - event.replyEmbeds(broadcast.getBroadData().build()).queue(); - } - case "dailypuzzlecc" -> { - DailyCommandCC daily = new DailyCommandCC(); - event.deferReply(true).queue(); - event.getChannel().sendMessageEmbeds(new EmbedBuilder().setColor(Color.magenta).setTitle("Chess.com Daily Puzzle").setImage(daily.getPuzzle()).setFooter("Click on URL for solution").build()).addActionRow(Button.link(daily.getPuzzleURL(), daily.getPuzzleSideToMove())).queue(); - } - case "service" -> { - EmbedBuilder embedBuildertos = new EmbedBuilder(); - embedBuildertos.setColor(Color.blue); - embedBuildertos.setTitle("Terms Of Service And Privacy Policy"); - embedBuildertos.setThumbnail("https://static-00.iconduck.com/assets.00/lichess-icon-512x512-q0oh5bwk.png"); - embedBuildertos.setDescription("What is LISEBOT Terms Of Service?\n" + - "\n" + - "User agrees that they will have to use latest updated versions of LISEBOT, User also agrees that some commands may be deleted if developer does not want to maintain those commands in future. User is fully responsible for their discord server and LISEBOT does not have any access to the server information/ management. User also agrees to privacy policy which states that LISEBOT does not and will not store any private information \n\n What information does LISEBOT store about me? What is the privacy policy?\n" + - "\n" + - "LISEBOT Does not and will not store any private user information, all bot commands are Lichess related so auth commands need Lichess token to operate for those commands (which the bot does not store)"); - event.replyEmbeds(embedBuildertos.build()).queue(); - } - - case "watchmaster" -> { - WatchMaster watchMaster = new WatchMaster(client); - event.deferReply(true).queue(); - event.getChannel().sendMessage(watchMaster.getMasterGames()).addActionRow(Button.link("https://lichess.org" + watchMaster.getGameId()[1], "Analyze")).queue(); - } - case "puzzle" -> { - if (this.spam.checkSpam(event)) { - event.reply("Only 1 puzzle request within 5 mins! Please take your time to solve the puzzle!").setEphemeral(true).queue(); - } else { - - try { - puzzle puzzle = new puzzle(); - event.reply("Generating Puzzle..").setEphemeral(false).queue(); - event.getChannel().sendMessageEmbeds(new EmbedBuilder().setColor(Color.green).setTitle("Chess.com Random Puzzle").setImage(puzzle.getPuzzle()).setFooter("Click on URL for solution").build()).addActionRow(Button.link(puzzle.getPuzzleURL(), puzzle.getPuzzleSideToMove())).queue(); - - } catch (Exception e) { - event.getChannel().sendMessage("An error occurred.. Please contact Dev, or wait for few mins to rerun the command").queue(); - } - - } - } - - case "help" -> { - CommandInfo commandInfo = new CommandInfo(); - event.replyEmbeds(commandInfo.getPageOne().build()).addActionRow(Button.primary("next", "➡️"), Button.link("https://discord.gg/K2NKarM5KV", "Support Server")).queue(); - } - case "playvariant" -> { - event.reply("**⚔️ Please Pick Your Game's Mode ⚔️ **" + "\n\n").addActionRow( - Button.success("960", "⚙️ Chess 960"), Button.success("3c", "➕ 3 check"), Button.success("atomic", "\uD83D\uDCA3 Atomic")).queue(); - } - case "play" -> { - event.reply("**⚔️ Please Pick Your Game's Mode **" + "\n\n").addActionRow( - Button.success("casmode", "Casual"), Button.danger("ratedmode", "Rated"), Button.primary("enginemode", "Play BOT"), Button.link("https://lichess.org/login", "Login/Register"), Button.secondary("playhelp", "❓ Help")).queue(); - } - case "profile" -> { - TextInput ptext = TextInput.create("profileuser", "Input Lichess Username", TextInputStyle.SHORT) - .setPlaceholder("Input Lichess Username") - .setMinLength(2) - .setMaxLength(100) - .build(); - Modal pmodal = Modal.create("modalpro", "View Lichess Profiles!") - .addActionRows(ActionRow.of(ptext)) - .build(); - event.replyModal(pmodal).queue(); - } - case "profilecc" -> { - TextInput ctext = TextInput.create("profileusercc", "Input Chess.com Username", TextInputStyle.SHORT) - .setPlaceholder("Input Chess.com Username") - .setMinLength(2) - .setMaxLength(100) - .build(); - Modal cmodal = Modal.create("modalproc", "View Chess.com Profiles!") - .addActionRows(ActionRow.of(ctext)) - .build(); - event.replyModal(cmodal).queue(); - } - case "streamers" -> { - LiveStreamers liveStreamers = new LiveStreamers(client); - event.replyEmbeds(liveStreamers.getTv().build()).queue(); - } - case "dailypuzzle" -> { - if (dailySpam.checkSpam(event)) { - event.reply("Check back after 24 hours for next daily puzzle!").setEphemeral(true).queue(); - } else { - DailyCommand dailyCommand = new DailyCommand(client); - event.replyEmbeds(new EmbedBuilder().setColor(Color.cyan).setTitle("Lichess Daily Puzzle").setImage(dailyCommand.getPuzzle()).setFooter("Use /answer to check your solution").build()).addActionRow(Button.link(dailyCommand.getPuzzleURL(), dailyCommand.getPuzzleSideToMove() + "| " + "Rating: " + dailyCommand.getRating()), Button.primary("sol", "View Solution"), Button.success("hint", "Hint")).queue(); - } - } - case "watch" -> { - if (watchLimit.checkSpam(event)) { - event.reply("You have hit max limit! You can only send 24 games in 1 day, try again in 24 hours!").setEphemeral(true).queue(); - } else { - - TextInput wtext = TextInput.create("watch_user_or_game", "Input Lichess Username Or Game", TextInputStyle.SHORT) - .setPlaceholder("Input Lichess Username Or Game") - .setMinLength(2) - .setMaxLength(100) - .setRequired(true) - - .build(); - Modal wmodal = Modal.create("modalwatch", "Watch Live Or Recent Lichess Games!") - .addActionRows(ActionRow.of(wtext)) - .build(); - event.replyModal(wmodal).queue(); - - } - } - case "arena" -> { - String arenaLink = event.getOption("arenaid").getAsString().trim(); - UserArena userArena = new UserArena(client, arenaLink); - event.deferReply(true).queue(); - event.getChannel().sendMessageEmbeds(userArena.getUserArena().build()).queue(); - } - case "invite" -> { - InviteMe inviteMe = new InviteMe(); - event.replyEmbeds(inviteMe.getInviteInfo().build()).queue(); - } - - } - - - } - - private boolean isLink(String link){ - return link.contains("/") && link.contains("."); - } - private String getValidGameId(String link){ - String[] spliter = link.split("/"); - String validGameId = ""; - - if(spliter.length<=3) - return null; - - if(spliter[3].length() == 12){ - validGameId += spliter[3].substring(0, spliter[3].length() - 4); - }else{ - validGameId += spliter[3]; - } - - if(!(link.contains("https://lichess.org/") && client.games().byGameId(validGameId).isPresent())){ - return null; - } - - return validGameId; - } - - - @Override - public void onModalInteraction(@NotNull ModalInteractionEvent event) { - Client client = Client.basic(); - String name = event.getModalId(); - - switch (name) { - case "modalwatch" -> { - String userInput = event.getValue("watch_user_or_game").getAsString().trim(); - if (isLink(userInput)) { - String validGameId = getValidGameId(userInput); - if (validGameId != null) { - String gameGif = "https://lichess1.org/game/export/gif/" + validGameId + ".gif?theme=blue&piece=kosal"; - event.reply(gameGif).queue(); - } else { - event.reply("Please provide a valid Lichess game!").queue(); - } - } else if (client.users().byId(userInput).isPresent()) { - UserGame userGame = new UserGame(client, userInput); - String link = "https://lichess.org/@/" + userInput.toLowerCase() + "/all"; - event.deferReply(true).queue(); - event.getChannel().sendMessage(userGame.getUserGames()).queue(); - - } else { - event.reply("Please Provide A Valid Lichess Username!").queue(); - } - } - case "modalpro" -> { - String userID = event.getValue("profileuser").getAsString().trim(); - this.ButtonUserId = userID; - UserProfile userProfile = new UserProfile(client, userID); - event.deferReply(true).queue(); - event.getChannel().sendMessage(userProfile.getUserProfile()).addActionRow(Button.danger("userpuzzle", "\uD83C\uDF2A️"), Button.link("https://lichess.org/@/" + this.ButtonUserId, "View On Lichess")).queue(); - } - case "modalproc" -> { - String usercc = event.getValue("profileusercc").getAsString().trim(); - CCProfile ccProfile = new CCProfile(usercc); - event.deferReply(true).queue(); - event.getChannel().sendMessageEmbeds(ccProfile.getCCProfile().build()).queue(); - } - case "modal-3c" -> { - try { - - - int min3c = Integer.parseInt(event.getValue("min-3c").getAsString()); - int sec = Integer.parseInt(event.getValue("sec-3c").getAsString()); - String bool = event.getValue("bool-3c").getAsString(); - Game three = new Game(); - - if (bool.equalsIgnoreCase("y")) { - three.DifferentGameGenVar(min3c, sec, "r", 3); - event.reply(three.getRandom()).queue(); - } else { - three.DifferentGameGenVar(min3c, sec, "c", 3); - event.reply(three.getRandom()).queue(); - } - - - } catch (Exception e) { - event.reply("error! Please provide valid parameters!").setEphemeral(true).queue(); - } - } - case "modal-9" -> { - try { - - - int min9c = Integer.parseInt(event.getValue("min-9").getAsString()); - int sec9 = Integer.parseInt(event.getValue("sec-9").getAsString()); - String bool = event.getValue("bool-9").getAsString(); - Game nine = new Game(); - - if (bool.equalsIgnoreCase("y")) { - nine.DifferentGameGenVar(min9c, sec9, "r", 9); - event.reply(nine.getRandom()).queue(); - } else { - nine.DifferentGameGenVar(min9c, sec9, "c", 9); - event.reply(nine.getRandom()).queue(); - } - - - } catch (Exception e) { - event.reply("error! Please provide valid parameters!").setEphemeral(true).queue(); - } - } - case "modal-a" -> { - try { - - - int min2c = Integer.parseInt(event.getValue("min-a").getAsString()); - int sec2 = Integer.parseInt(event.getValue("sec-a").getAsString()); - String bool = event.getValue("bool-a").getAsString(); - Game two = new Game(); - - if (bool.equalsIgnoreCase("y")) { - two.DifferentGameGenVar(min2c, sec2, "r", 2); - event.reply(two.getRandom()).queue(); - } else { - two.DifferentGameGenVar(min2c, sec2, "c", 2); - event.reply(two.getRandom()).queue(); - } - - - } catch (Exception e) { - event.reply("error! Please provide valid parameters!").setEphemeral(true).queue(); - } - } - } - - - } - - - - @Override - public void onButtonInteraction(@NotNull ButtonInteractionEvent event) { - - Client client = Client.basic(); - - - WatchMaster watchMaster = new WatchMaster(client); - CommandInfo commandInfo = new CommandInfo(); - DailyCommand dailyCommand = new DailyCommand(client); - - switch (event.getComponentId()){ - case "bot-lose": - this.board.loadFromFen(new Board().getFen()); - event.editMessageEmbeds(new EmbedBuilder().setDescription("You have resigned the game!").setColor(Color.red).build()).setActionRow(Button.danger("bot-lose", "Resgin").asDisabled(), Button.secondary("bot-draw", "Draw").asDisabled()).queue(); - break; - case "bot-draw": - this.board.loadFromFen(new Board().getFen()); - event.editMessageEmbeds(new EmbedBuilder().setDescription("Lise accepts the draw!").setColor(Color.yellow).build()).setActionRow(Button.danger("bot-lose", "Resgin").asDisabled(), Button.secondary("bot-draw", "Draw").asDisabled()).queue(); - break; - } - - switch (event.getComponentId()){ - case "3c": - TextInput wtext = TextInput.create("min-3c", "Input Time Mins [1 to 10]", TextInputStyle.SHORT) - .setPlaceholder("Input Time Mins [1 to 10]") - .setMinLength(1) - .setMaxLength(2) - .setRequired(true) - .build(); - TextInput stext = TextInput.create("sec-3c", "Input Time secs [1 to 10]", TextInputStyle.SHORT) - .setPlaceholder("Input Time secs [1 to 10]") - .setMinLength(1) - .setMaxLength(2) - .setRequired(true) - .build(); - TextInput btext = TextInput.create("bool-3c", "is Rated? [Y or N]", TextInputStyle.SHORT) - .setPlaceholder("is Rated? [Y or N]") - .setMinLength(1) - .setMaxLength(2) - .setRequired(true) - .build(); - - Modal wmodal = Modal.create("modal-3c", "Create 3 check games") - .addActionRows(ActionRow.of(wtext)) - .addActionRows(ActionRow.of(stext)) - .addActionRows(ActionRow.of(btext)) - .build(); - event.replyModal(wmodal).queue(); - break; - - case "atomic": - TextInput awtext = TextInput.create("min-a", "Input Time Mins [1 to 10]", TextInputStyle.SHORT) - .setPlaceholder("Input Time Mins [1 to 10]") - .setMinLength(1) - .setMaxLength(2) - .setRequired(true) - .build(); - TextInput astext = TextInput.create("sec-a", "Input Time secs [1 to 10]", TextInputStyle.SHORT) - .setPlaceholder("Input Time secs [1 to 10]") - .setMinLength(1) - .setMaxLength(2) - .setRequired(true) - .build(); - TextInput abtext = TextInput.create("bool-a", "is Rated? [Y or N]", TextInputStyle.SHORT) - .setPlaceholder("is Rated? [Y or N]") - .setMinLength(1) - .setMaxLength(2) - .setRequired(true) - .build(); - - Modal amodal = Modal.create("modal-a", "Create Atomic Games") - .addActionRows(ActionRow.of(awtext)) - .addActionRows(ActionRow.of(astext)) - .addActionRows(ActionRow.of(abtext)) - .build(); - event.replyModal(amodal).queue(); - break; - - case "960": - TextInput ninewtext = TextInput.create("min-9", "Input Time Mins [1 to 10]", TextInputStyle.SHORT) - .setPlaceholder("Input Time Mins [1 to 10]") - .setMinLength(1) - .setMaxLength(2) - .setRequired(true) - .build(); - TextInput ninestext = TextInput.create("sec-9", "Input Time secs [1 to 10]", TextInputStyle.SHORT) - .setPlaceholder("Input Time secs [1 to 10]") - .setMinLength(1) - .setMaxLength(2) - .setRequired(true) - .build(); - TextInput ninebtext = TextInput.create("bool-9", "is Rated? [Y or N]", TextInputStyle.SHORT) - .setPlaceholder("is Rated? [Y or N]") - .setMinLength(1) - .setMaxLength(2) - .setRequired(true) - .build(); - - Modal nmodal = Modal.create("modal-9", "Create Chess960 Games") - .addActionRows(ActionRow.of(ninewtext)) - .addActionRows(ActionRow.of(ninestext)) - .addActionRows(ActionRow.of(ninebtext)) - .build(); - event.replyModal(nmodal).queue(); - break; - } - - - if(event.getComponentId().equals("playhelp")){ - EmbedBuilder help = new EmbedBuilder(); - help.setThumbnail("https://static-00.iconduck.com/assets.00/lichess-icon-512x512-q0oh5bwk.png"); - help.setTitle("Guide for /play"); - help.setDescription("/play allows you to play LIVE chess with friends and BOTs!, to set up a **Casual game (friendly)/ Rated (gain/lose rating)** all users need to do is click on **casual/rated** button\n" + - "After you will be prompted to select **Time control**, this option is timecontrol (how long game lasts). \n" + - "**Start the game**: One you have selected mode and time, Bot sends Lichess live URL, where you and your friend can click same time to start a **LIVE Chess game**." + - "\n\n **Login/Register** \n To play rated make sure to Login/Register on Lichess.org to get chess rating, otherwise just play casual games!"+ - "\n **Play BOTS** " + - "\n To play BOTS click on **Play BOTS**, to play live computer click on **Stockfish** to play BOTS on Lichess click on other options!" + - "\n **Need more help?** \n Join our Support server and Developer will help you!"); - event.replyEmbeds(help.build()).addActionRow(Button.link("https://discord.gg/K2NKarM5KV", "Support Server")).setEphemeral(true).queue(); - } - - - if(event.getComponentId().equals("casmode")) { - event.editMessage("**⏱️ Please Pick Your Time Control ⏱️**").setActionRow( - Button.primary("ultrafastc", "1/4+0"), - Button.primary("bulletfastc", "1+0"), - Button.primary("blitzfastc", "3+2"), - Button.primary("rapidfastc", "5+5"), - Button.success("loadc", "\uD83D\uDD04 Load More Time Controls") - ).queue(); - - } - - if(event.getComponentId().equals("ratedmode")){ - event.editMessage("**⏱️ Please Pick Your Time Control ⏱️**").setActionRow( - Button.danger("ultrafastr", "1/4+0"), - Button.danger("bulletfastr", "1+0"), - Button.danger("blitzfastr", "3+2"), - Button.danger("rapidfastr", "5+5"), - Button.success("loadr", "\uD83D\uDD04 Load More Time Controls") - ).queue(); - - } - - if(event.getComponentId().equals("enginemode")){ - event.editMessage("** Challenge This BOTs! **").setActionRow( - Button.link("https://listudy.org/en/play-stockfish", "Stockfish"), - Button.link("https://lichess.org/@/leela2200", "LeelaZero"), - Button.link("https://lichess.org/@/Dummyette", "Dummyette"), - Button.link("https://lichess.org/@/SimplerEval", "SimplerEval") - - ).queue(); - } - - switch (event.getComponentId()){ - case "loadr": - event.editMessage("**⏱️ Please Pick Your Time Control ⏱️**").setActionRow(Button.danger("3+0r", "3+0") - , Button.danger("5+0r", "5+0") - , Button.danger("10+0r", "10+0")).queue(); - break; - case "loadc": - event.editMessage("**⏱️ Please Pick Your Time Control ⏱️**").setActionRow(Button.primary("3+0c", "3+0") - , Button.primary("5+0c", "5+0") - , Button.primary("10+0c", "10+0")).queue(); - break; - case "3+0r": - Game threeP0 = new Game(); - threeP0.DifferentGameGen(3,0,"r"); - event.editMessage(threeP0.getRandom()).setActionRow(Button.primary("3+0r", "Rematch")).queue(); - - break; - case "5+0r": - Game fP0 = new Game(); - fP0.DifferentGameGen(5,0,"r"); - event.editMessage(fP0.getRandom()).setActionRow(Button.primary("5+0r", "Rematch")).queue(); - - break; - case "10+0r": - Game tP0 = new Game(); - tP0.DifferentGameGen(10,0,"r"); - - event.editMessage(tP0.getRandom()).setActionRow(Button.primary("10+0r", "Rematch")).queue(); - - break; - case "3+0c": - Game threeP0c = new Game(); - threeP0c.DifferentGameGen(3,0,"c"); - - event.editMessage(threeP0c.getRandom()).setActionRow(Button.primary("3+0c", "Rematch")).queue(); - - break; - case "5+0c": - Game fP0c = new Game(); - fP0c.DifferentGameGen(5,0,"c"); - - event.editMessage(fP0c.getRandom()).setActionRow(Button.primary("5+0c", "Rematch")).queue(); - - break; - case "10+0c": - Game tP0c = new Game(); - tP0c.DifferentGameGen(10,0,"c"); - - event.editMessage(tP0c.getRandom()).setActionRow(Button.primary("10+0c", "Rematch")).queue(); - - break; - } - - switch (event.getComponentId()){ - case "ultrafastc": - Game ug = new Game(); - ug.DifferentGameGen(0,0,"c"); - event.editMessage(ug.getRandom()).setActionRow(Button.primary("ultrafastc", "Rematch")).queue(); - case "bulletfastc": - Game bg = new Game(); - bg.DifferentGameGen(1, 0, "c"); - event.editMessage(bg.getRandom()).setActionRow(Button.primary("bulletfastc", "Rematch")).queue(); - - break; - case "blitzfastc": - Game bcg = new Game(); - bcg.DifferentGameGen(3,2,"c"); - event.editMessage(bcg.getRandom()).setActionRow(Button.primary("blitzfastc", "Rematch")).queue(); - break; - case "rapidfastc": - Game rg = new Game(); - rg.DifferentGameGen(5,5, "c"); - event.editMessage(rg.getRandom()).setActionRow(Button.primary("rapidfastc", "Rematch")).queue(); - break; - - } - - switch (event.getComponentId()){ - case "ultrafastr": - Game ug = new Game(); - ug.DifferentGameGen(0,0,"r"); - event.editMessage(ug.getRandom()).setActionRow(Button.primary("ultrafastr", "Rematch")).queue(); - case "bulletfastr": - Game bg = new Game(); - bg.DifferentGameGen(1, 0, "r"); - event.editMessage(bg.getRandom()).setActionRow(Button.primary("bulletfastr", "Rematch")).queue(); - break; - case "blitzfastr": - Game bcg = new Game(); - bcg.DifferentGameGen(3,2,"r"); - event.editMessage(bcg.getRandom()).setActionRow(Button.primary("blitzfastr", "Rematch")).queue(); - break; - case "rapidfastr": - Game rg = new Game(); - rg.DifferentGameGen(5,5,"r"); - event.editMessage(rg.getRandom()).setActionRow(Button.primary("rapidfastr", "Rematch")).queue(); - break; - - } - - - if(event.getComponentId().equals("userpuzzle")){ - UserDashboard userDashboard = new UserDashboard(this.ButtonClient, this.ButtonUserId); - event.editMessageEmbeds(userDashboard.getUserDashboard().build()).setActionRow(Button.danger("userpuzzle","\uD83C\uDF2A️").asDisabled(), Button.primary("userstreaming", "\uD83C\uDF99️").asDisabled()).queue(); - } - - - if(event.getComponentId().equals("next")){ - event.editMessageEmbeds(commandInfo.getPageTwo().build()).setActionRow(Button.primary("nexttwo", "➡️"), Button.link("https://discord.gg/K2NKarM5KV", "Support Server")).queue(); - }else if(event.getComponentId().equals("nexttwo")){ - event.editMessageEmbeds(commandInfo.getPageThree().build()).setActionRow(Button.primary("nextthree", "➡️").asDisabled(), Button.link("https://discord.gg/K2NKarM5KV", "Support Server")).queue(); - } - - if(event.getComponentId().equals("sol")){ - event.reply(dailyCommand.getSolution()).setEphemeral(true).queue(); - } - - - - if(event.getComponentId().equals("hint")){ - event.replyEmbeds(dailyCommand.getThemes().build()).setEphemeral(true).queue(); - } - - } - - - - - - - -} diff --git a/src/main/java/Controller/DailyCommand.java b/src/main/java/Controller/DailyCommand.java deleted file mode 100644 index 3876d47..0000000 --- a/src/main/java/Controller/DailyCommand.java +++ /dev/null @@ -1,205 +0,0 @@ -import chariot.Client; -import chariot.model.One; -import chariot.model.Puzzle; -import com.github.bhlangonijr.chesslib.Board; -import net.dv8tion.jda.api.EmbedBuilder; -import java.awt.*; -import java.util.List; - - -public class DailyCommand extends ChessPuzzle { - - - private String moveSay = ""; - private int rating; - Client client = this.getClient(); - Board board = this.getBoard(); - - - public DailyCommand(Client client) { - super(client, new Board()); - } - - - - @Override - public String getSolution(){ - - - One dailypuzzle = client.puzzles().dailyPuzzle(); - - - if (dailypuzzle.isPresent()) { - Puzzle puzzle1 = dailypuzzle.get(); - - - String[] moves = chariot.Client.basic().puzzles().dailyPuzzle().get().game().pgn().split(" "); - for (String move : moves) { - board.doMove(move); - - } - board.doMove(puzzle1.puzzle().solution().get(0)); - - - String cor = board.getFen(); - - String coordImg = ""; - - String[] split = cor.split(" "); - - - if(split[1].contains("b")){ - coordImg = "https://lichess1.org/export/fen.gif?fen=" + split[0] + "&color=white&theme=brown&piece=kosal"; - }else{ - coordImg = "https://lichess1.org/export/fen.gif?fen=" + split[0] + "&color=black&theme=brown&piece=kosal"; - } - - return coordImg; - }else{ - return "loading..."; - } - - - - } - - @Override - public String getPuzzle() { - One dailypuzzle = client.puzzles().dailyPuzzle(); - - - if (dailypuzzle.isPresent()) { // check if the puzzle is present - Puzzle puzzle1 = dailypuzzle.get(); - - - String[] moves = chariot.Client.basic().puzzles().dailyPuzzle().get().game().pgn().split(" "); - for (String move : moves) { - board.doMove(move); - } - - - String cor = board.getFen(); - - String[] split = cor.split(" "); - - if(split[1].contains("w")){ - moveSay += "White To Move"; - }else{ - moveSay += "Black To Move"; - - } - - String coordImg = ""; - - - if(split[1].contains("w")){ - coordImg = "https://lichess1.org/export/fen.gif?fen=" + split[0] + "&color=white&theme=blue&piece=cardinal"; - //this.blindmode = "https://lichess1.org/export/fen.gif?fen=" + split[0] + "&color=white&theme=blue&piece=disguised"; - }else{ - coordImg = "https://lichess1.org/export/fen.gif?fen=" + split[0] + "&color=black&theme=blue&piece=cardinal"; - //this.blindmode = "https://lichess1.org/export/fen.gif?fen=" + split[0] + "&color=black&theme=blue&piece=disguised"; - - } - - - - Puzzle.PuzzleInfo puzzleInfo = puzzle1.puzzle(); - - this.rating = puzzleInfo.rating(); - - - - - - - return coordImg; - }else{ - return "loading.."; - } - } - - @Override - public String getPuzzleURL() { - return "https://lichess.org/training/" + client.puzzles().dailyPuzzle().get().puzzle().id(); - } - - @Override - public EmbedBuilder getThemes(){ - EmbedBuilder themes = new EmbedBuilder(); - - themes.setColor(Color.orange); - - One dailypuzzle = client.puzzles().dailyPuzzle(); - - StringBuilder themessay = new StringBuilder(); - - for(int i = 0; i < dailypuzzle.get().puzzle().themes().size(); i++){ - themessay.append(dailypuzzle.get().puzzle().themes().get(i)).append(" "); - } - - themes.setDescription( "**"+ themessay + "**"); - themes.setTitle("Some Hints..."); - return themes; - } - - @Override - public String getPuzzleSideToMove() { - return moveSay; - } - - @Override - public int getRating(){ - return rating; - } - - @Override - public boolean checkSolution(String answer) { - try { - Board checker = new Board(); - String[] moves = chariot.Client.basic().puzzles().dailyPuzzle().get().game().pgn().split(" "); - for (String move : moves) { - checker.doMove(move); - } - - String startFenPuzzle = checker.getFen(); - - String[] aMove = answer.split(" "); - for (String move : aMove) { - checker.doMove(move); - } - - String ansFEN = checker.getFen(); - - Board checkSolutionBoard = new Board(); - checkSolutionBoard.loadFromFen(startFenPuzzle); - - List chechSol = chariot.Client.basic().puzzles().dailyPuzzle().get().puzzle().solution(); - - System.out.println(chechSol); - - for (String move : chechSol) { - checkSolutionBoard.doMove(move); - } - - String puzzleEND = checkSolutionBoard.getFen(); - - System.out.println(puzzleEND); - System.out.println(ansFEN); - - return puzzleEND.equalsIgnoreCase(ansFEN); - - }catch (Exception e){ - return false; - } - - } - - -} - - - - - - - diff --git a/src/main/java/Controller/DailyCommandCC.java b/src/main/java/Controller/DailyCommandCC.java deleted file mode 100644 index 506c196..0000000 --- a/src/main/java/Controller/DailyCommandCC.java +++ /dev/null @@ -1,58 +0,0 @@ -import io.github.sornerol.chess.pubapi.client.DailyPuzzleClient; -import io.github.sornerol.chess.pubapi.exception.ChessComPubApiException; -import java.io.IOException; - - -public class DailyCommandCC extends ChessPuzzle { - - - private final DailyPuzzleClient dailyPuzzleClient = this.getDailyPuzzleClient(); - private String moveSay = new String(""); - private String solLink = new String(""); - - - public DailyCommandCC(){ - super(); - } - - @Override - public String getPuzzle() { - try { - String fen = dailyPuzzleClient.getTodaysDailyPuzzle().getFen(); - String[] split = fen.split(" "); - if(split[1].contains("w")){ - moveSay += "White To Move"; - - }else{ - moveSay += "Black To Move"; - - } - this.solLink += "https://lichess.org/analysis/standard/" + fen.replace(" ", "_"); - - return "https://lichess1.org/export/fen.gif?fen=" + split[0] + "&theme=brown&piece=kosal"; - - } catch (IOException | ChessComPubApiException e) { - throw new RuntimeException(e); - } - } - - @Override - public String getSolution() { - return null; - } - - @Override - public String getPuzzleURL() { - return solLink; - } - - @Override - public String getPuzzleSideToMove() { - return moveSay; - } - - - - - -} diff --git a/src/main/java/Controller/Game.java b/src/main/java/Controller/Game.java deleted file mode 100644 index 85c3da6..0000000 --- a/src/main/java/Controller/Game.java +++ /dev/null @@ -1,206 +0,0 @@ -import chariot.Client; -import net.dv8tion.jda.api.EmbedBuilder; - - - -public class Game { - - private Client client; - - private EmbedBuilder embedBuilder; - - private String variant; - - private String challengeType; - - private String random = ""; - - - public Game(){ - - } - - - public Game(Client client, String variant, String challengeType){ - this.client = client; - this.variant = variant; - this.challengeType = challengeType; - - } - - - - public void DifferentGameGenVar(int min, int sec, String type, int key){ - - switch (key){ - case 3: - if(type.equals("r")){ - - int timeer = min*60; - - Client clientone = Client.basic(); - - - var result = clientone.challenges().challengeOpenEnded(conf -> conf.clock(timeer, sec).name("LISEBOT Challenge Created! Please Join the Game!").variant(provider -> provider.threeCheck()).rated(true)); - - result.ifPresent(play -> { - - this.random += play.challenge().url(); - }); - }else{ - int timeer = min*60; - - Client clientone = Client.basic(); - - - var result = clientone.challenges().challengeOpenEnded(conf -> conf.clock(timeer, sec).name("LISEBOT Challenge Created! Please Join the Game!").variant(provider -> provider.threeCheck()).rated(false)); - - result.ifPresent(play -> { - - - this.random += play.challenge().url(); - }); - } - break; - - case 9: - if(type.equals("r")){ - - int timeer = min*60; - - Client clientone = Client.basic(); - - - var result = clientone.challenges().challengeOpenEnded(conf -> conf.clock(timeer, sec).name("LISEBOT Challenge Created! Please Join the Game!").variant(provider -> provider.chess960()).rated(true)); - - result.ifPresent(play -> { - - - this.random += play.challenge().url(); - }); - }else{ - int timeer = min*60; - - Client clientone = Client.basic(); - - - var result = clientone.challenges().challengeOpenEnded(conf -> conf.clock(timeer, sec).name("LISEBOT Challenge Created! Please Join the Game!").variant(provider -> provider.chess960()).rated(false)); - - result.ifPresent(play -> { - - - this.random += play.challenge().url(); - }); - } - break; - case 2: - if(type.equals("r")){ - - int timeer = min*60; - - Client clientone = Client.basic(); - - - var result = clientone.challenges().challengeOpenEnded(conf -> conf.clock(timeer, sec).name("LISEBOT Challenge Created! Please Join the Game!").variant(provider -> provider.atomic()).rated(true)); - - result.ifPresent(play -> { - - - this.random += play.challenge().url(); - }); - }else{ - int timeer = min*60; - - Client clientone = Client.basic(); - - - var result = clientone.challenges().challengeOpenEnded(conf -> conf.clock(timeer, sec).name("LISEBOT Challenge Created! Please Join the Game!").variant(provider -> provider.atomic()).rated(false)); - - result.ifPresent(play -> { - - - this.random += play.challenge().url(); - }); - } - break; - - } - - - - - } - - - public void DifferentGameGen(int min, int sec, String type){ - - if(type.equals("r")){ - if(min == 0){ - int ultra = 15; - - Client clientone = Client.basic(); - - - var result = clientone.challenges().challengeOpenEnded(conf -> conf.clock(ultra, sec).name("LISEBOT Challenge Created! Please Join the Game!").rated(true)); - - result.ifPresent(play -> { - - - this.random += play.challenge().url(); - }); - }else { - - int timeer = min * 60; - - Client clientone = Client.basic(); - - - var result = clientone.challenges().challengeOpenEnded(conf -> conf.clock(timeer, sec).name("LISEBOT Challenge Created! Please Join the Game!").rated(true)); - - result.ifPresent(play -> { - - - this.random += play.challenge().url(); - }); - } - }else{ - if(min == 0){ - int ultraC = 15; - - Client clientone = Client.basic(); - - - var result = clientone.challenges().challengeOpenEnded(conf -> conf.clock(ultraC, sec).name("LISEBOT Challenge Created! Please Join the Game!").rated(false)); - - result.ifPresent(play -> { - - - this.random += play.challenge().url(); - }); - } - { - int timeer = min * 60; - - Client clientone = Client.basic(); - - - var result = clientone.challenges().challengeOpenEnded(conf -> conf.clock(timeer, sec).name("LISEBOT Challenge Created! Please Join the Game!").rated(false)); - - result.ifPresent(play -> { - - - this.random += play.challenge().url(); - }); - } - } - - - } - - - public String getRandom() { - return random; - } - - -} \ No newline at end of file diff --git a/src/main/java/Controller/LichessBotRunner.java b/src/main/java/Controller/LichessBotRunner.java deleted file mode 100644 index fa16a92..0000000 --- a/src/main/java/Controller/LichessBotRunner.java +++ /dev/null @@ -1,181 +0,0 @@ -import chariot.Client; -import chariot.model.Enums; -import chariot.model.Event; -import chariot.model.GameStateEvent; -import chariot.model.VariantType; -import chariot.model.Enums.Speed; - -import com.github.bhlangonijr.chesslib.*; -import com.github.bhlangonijr.chesslib.move.Move; - -import java.util.Random; - -public class LichessBotRunner { - - public LichessBotRunner(){ - - } - - - public static void main(String[] args) { - - var client = Client.auth(System.getenv("lichess_bot_token")); - var bot = client.bot(); - var events = bot.connect().stream(); - var username = client.account().profile().get().name().toLowerCase(); - String[] s = {"maia1", "maia5", "maia9", "charibot", "TurtleBot", "SxRandom", "zeekat", "roundmoundofrebounds", "WorstFish", "pawnrobot", "knucklefish", "LeelaRogue"}; - int picker = s.length; - int index = new Random().nextInt(picker); - String botname = s[index]; - try { - bot.challengeKeepAlive(botname, challengeBuilder -> challengeBuilder.clockBlitz3m2s().rated(false).color(Enums.ColorPref.white)); - }catch (Exception e){ - System.out.println("Failed Challege"); - } - - events.forEach(event -> { - - - switch (event.type()) { - - case challenge: - - var challenge = (Event.ChallengeEvent) event; - boolean std = challenge.challenge().gameType().variant() == VariantType.Variant.standard; - boolean non_rated = challenge.challenge().gameType().rated(); - boolean isCoores = challenge.challenge().gameType().timeControl().speed() == Speed.correspondence; - if(std && !non_rated && !isCoores ){ - bot.acceptChallenge(event.id()); - }else if(non_rated){ - bot.declineChallenge(event.id(), provider -> provider.casual()); - - }else if(isCoores) { - bot.declineChallenge(event.id(), provider -> provider.timeControl()); - - } - else{ - bot.declineChallenge(event.id(), provider -> provider.variant()); - } - - break; - - - - case challengeDeclined: - bot.abort(event.id()); - - break; - - case challengeCanceled: - bot.abort(event.id()); - - break; - - case gameFinish: - bot.chat(event.id(), "Thanks for playing me! ggs"); - bot.chatSpectators(event.id(), "Thanks for watching!"); - - break; - - - case gameStart: - - var gameEvents = bot.connectToGame(event.id()).stream(); - var board = new Board(); - var engine = new LiseChessEngine(board); - boolean[] isWhite = {false}; - - - - bot.chat(event.id(), "omg you are very strong.. I'm scared but hey good luck!!"); - - - - gameEvents.forEach(gameEvent -> { - - - - - switch (gameEvent.type()) { - - - case opponentGone: - bot.abort(event.id()); - - break; - - case gameFull: - - try { - - isWhite[0] = ((GameStateEvent.Full) gameEvent).white().name().toLowerCase().equals(username); - if (isWhite[0]) { - try { - - var move = engine.generateMoveFromIndexLookUp(board); - bot.move(event.id(), move.toString()); - board.doMove(move); - - } catch (Exception e) { - bot.resign(event.id()); - } - } - - }catch (Exception e){ - bot.resign(event.id()); - System.out.println(e.getMessage()); - } - - break; - - case gameState: - try { - - var names = ((GameStateEvent.State) gameEvent).moves().split(" "); - var whiteTurn = names.length % 2 == 0; - - if (isWhite[0] == whiteTurn) { - try { - var name = names[names.length - 1]; - var from = Square.fromValue(name.substring(0, 2).toUpperCase()); - var to = Square.fromValue(name.substring(2, 4).toUpperCase()); - if (names.length == 5) { - var type = PieceType.fromSanSymbol(name.substring(4).toUpperCase()); - var piece = Piece.make(whiteTurn ? Side.WHITE : Side.BLACK, type); - var move = new Move(from, to, piece); - board.doMove(move); - } else { - var move = new Move(from, to); - board.doMove(move); - } - }catch (Exception e){ - bot.resign(event.id()); - } - - - var move = engine.generateMoveFromIndexLookUp(board); - bot.move(event.id(), move.toString()); - board.doMove(move); - - } - - }catch (Exception e){ - bot.resign(event.id()); - - } - break; - } - }); - - - - break; - } - }); - - - } - - - -} diff --git a/src/main/java/Controller/LiseChessEngine.java b/src/main/java/Controller/LiseChessEngine.java deleted file mode 100644 index ccb9319..0000000 --- a/src/main/java/Controller/LiseChessEngine.java +++ /dev/null @@ -1,478 +0,0 @@ - -import com.github.bhlangonijr.chesslib.*; -import com.github.bhlangonijr.chesslib.move.Move; -import com.github.bhlangonijr.chesslib.move.MoveGenerator; - - - -import java.util.*; - - -public class LiseChessEngine { - - private Board board; - - - - public LiseChessEngine(Board board){ - this.board = board; - } - - - - public Boolean gameOver(){ - if(this.board.isMated() || this.board.isDraw() || this.board.isStaleMate()){ - return true; - } - - return false; - } - - - - public void playDiscordBotMoves(){ - this.board.doMove(findBestMove()); - } - - public List countPiecesByTypeForSide(String fen, char side) { - String[] parts = fen.split(" "); - String placement = parts[0]; - List getVal = new ArrayList<>(); - - - int pawnCount = 0; - int knightCount = 0; - int bishopCount = 0; - int rookCount = 0; - int queenCount = 0; - int kingCount = 0; - - for (char c : placement.toCharArray()) { - - switch (c) { - case 'P': - if (Character.isUpperCase(c) == (side == 'w')) { - pawnCount++; - } - break; - case 'N': - if (Character.isUpperCase(c) == (side == 'w')) { - knightCount++; - } - break; - case 'B': - if (Character.isUpperCase(c) == (side == 'w')) { - bishopCount++; - } - break; - case 'R': - if (Character.isUpperCase(c) == (side == 'w')) { - rookCount++; - } - break; - case 'Q': - if (Character.isUpperCase(c) == (side == 'w')) { - queenCount++; - } - break; - case 'K': - if (Character.isUpperCase(c) == (side == 'w')) { - kingCount++; - } - break; - case 'p': - if (Character.isLowerCase(c) == (side == 'b')) { - pawnCount++; - } - break; - case 'n': - if (Character.isLowerCase(c) == (side == 'b')) { - knightCount++; - } - break; - case 'b': - if (Character.isLowerCase(c) == (side == 'b')) { - bishopCount++; - } - break; - case 'r': - if (Character.isLowerCase(c) == (side == 'b')) { - rookCount++; - } - break; - case 'q': - if (Character.isLowerCase(c) == (side == 'b')) { - queenCount++; - } - break; - case 'k': - if (Character.isLowerCase(c) == (side == 'b')) { - kingCount++; - } - break; - default: - break; - } - } - - getVal.add(pawnCount); - getVal.add(knightCount); - getVal.add(rookCount); - getVal.add(queenCount); - getVal.add(bishopCount); - - - return getVal; - - - } - - public int calculatePieceEval(Board board){ - - List whiteSide = countPiecesByTypeForSide(board.getFen(), 'w'); - List blackSide = countPiecesByTypeForSide(board.getFen(), 'b'); - - - - int evalwhite = (whiteSide.get(0) * 10) + (whiteSide.get(1) * 30) + (whiteSide.get(2) * 50) + (whiteSide.get(3) * 150) + (whiteSide.get(4) * 30) + (1 * 700); - int evalblack = (blackSide.get(0) * 10) + (blackSide.get(1) * 30) + (blackSide.get(2) * 50) + (blackSide.get(3) * 150) + (blackSide.get(4) * 30) + (1 * 700); - - return (evalwhite - evalblack); - - - } - - - private int evaluateBoard(Board board) { - - - - try { - - - int BISHOP_VALUE = 6; - int KNIGHT_VALUE = BISHOP_VALUE + 2; - int PAWN_VALUE = BISHOP_VALUE + 1; - int QUEEN_VALUE = 1; - int ROOK_VALUE = 1; - int KING_VALUE = 0; - - int KING_ATTACKED = 70; - int KING_MATED = 500; - - int score = 0; - int scoreb = 0; - int scorew = 0; - - - score += (board.legalMoves().size()); - score += calculatePieceEval(board); - try { - for (int i = 0; i < board.legalMoves().size(); i++) { - if (board.getSideToMove().equals(Side.WHITE)) { - if (board.getPiece(board.legalMoves().get(i).getFrom()).getPieceType().equals(PieceType.BISHOP)) { - scorew += BISHOP_VALUE; - } else if (board.getPiece(board.legalMoves().get(i).getFrom()).getPieceType().equals(PieceType.KNIGHT)) { - scorew += KNIGHT_VALUE; - } else if (board.getPiece(board.legalMoves().get(i).getFrom()).getPieceType().equals(PieceType.PAWN)) { - scorew += PAWN_VALUE; - } else if (board.getPiece(board.legalMoves().get(i).getFrom()).getPieceType().equals(PieceType.QUEEN)) { - scorew += QUEEN_VALUE; - } else if (board.getPiece(board.legalMoves().get(i).getFrom()).getPieceType().equals(PieceType.ROOK)) { - scorew += ROOK_VALUE; - } else { - scorew += KING_VALUE; - } - }else if(board.getSideToMove().flip().equals(Side.BLACK)){ - if (board.getPiece(board.legalMoves().get(i).getFrom()).getPieceType().equals(PieceType.BISHOP)) { - scoreb -= BISHOP_VALUE; - } else if (board.getPiece(board.legalMoves().get(i).getFrom()).getPieceType().equals(PieceType.KNIGHT)) { - scoreb -= KNIGHT_VALUE; - } else if (board.getPiece(board.legalMoves().get(i).getFrom()).getPieceType().equals(PieceType.PAWN)) { - scoreb -= PAWN_VALUE; - } else if (board.getPiece(board.legalMoves().get(i).getFrom()).getPieceType().equals(PieceType.QUEEN)) { - scoreb -= QUEEN_VALUE; - } else if (board.getPiece(board.legalMoves().get(i).getFrom()).getPieceType().equals(PieceType.ROOK)) { - scoreb -= ROOK_VALUE; - } else if (board.getPiece(board.legalMoves().get(i).getFrom()).getPieceType().equals(PieceType.KING)){ - scoreb -= KING_VALUE; - } - - } - } - - - - if(!board.isKingAttacked()) { - for (int j = 0; j < board.pseudoLegalCaptures().size(); j++) { - if (board.getSideToMove().equals(Side.WHITE)) { - if (board.getPiece(board.pseudoLegalCaptures().get(j).getFrom()).getPieceType().equals(PieceType.BISHOP)) { - scorew += BISHOP_VALUE + 1; - } else if (board.getPiece(board.pseudoLegalCaptures().get(j).getFrom()).getPieceType().equals(PieceType.KNIGHT)) { - scorew += KNIGHT_VALUE + 1; - } else if (board.getPiece(board.pseudoLegalCaptures().get(j).getFrom()).getPieceType().equals(PieceType.PAWN)) { - scorew += PAWN_VALUE + 1; - } else if (board.getPiece(board.pseudoLegalCaptures().get(j).getFrom()).getPieceType().equals(PieceType.QUEEN)) { - scorew += QUEEN_VALUE + 1; - } else if (board.getPiece(board.pseudoLegalCaptures().get(j).getFrom()).getPieceType().equals(PieceType.ROOK)) { - scorew += ROOK_VALUE + 1; - } else { - scorew += KING_VALUE + 1; - } - } else if(board.getSideToMove().flip().equals(Side.BLACK)){ - if (board.getPiece(board.pseudoLegalCaptures().get(j).getFrom()).getPieceType().equals(PieceType.BISHOP)) { - scoreb -= BISHOP_VALUE + 1; - } else if (board.getPiece(board.pseudoLegalCaptures().get(j).getFrom()).getPieceType().equals(PieceType.KNIGHT)) { - scoreb -= KNIGHT_VALUE + 1; - } else if (board.getPiece(board.pseudoLegalCaptures().get(j).getFrom()).getPieceType().equals(PieceType.PAWN)) { - scoreb -= PAWN_VALUE + 1; - } else if (board.getPiece(board.pseudoLegalCaptures().get(j).getFrom()).getPieceType().equals(PieceType.QUEEN)) { - scoreb -= QUEEN_VALUE + 1; - } else if (board.getPiece(board.pseudoLegalCaptures().get(j).getFrom()).getPieceType().equals(PieceType.ROOK)) { - scoreb -= ROOK_VALUE + 1; - } else if (board.getPiece(board.pseudoLegalCaptures().get(j).getFrom()).getPieceType().equals(PieceType.KING)){ - scoreb -= KING_VALUE + 1; - } - - } - } - }else{ - if(board.getSideToMove().equals(Side.WHITE)){ - scorew += board.pseudoLegalCaptures().size() + 1; - - } else if (board.getSideToMove().equals(Side.BLACK)) { - scoreb -= board.pseudoLegalCaptures().size() - 1; - } - } - - - - - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - if (board.isKingAttacked() && board.getSideToMove().equals(Side.WHITE)) { - score += KING_ATTACKED; - }else{ - score -= KING_ATTACKED; - } - - if (board.isMated() && board.getSideToMove().equals(Side.WHITE)) { - score += KING_MATED; - }else{ - score -= KING_MATED; - } - - - if(board.getSideToMove().equals(Side.WHITE)){ - return score + (scorew - scoreb); - } - - - - return -1 * score; - }catch (Exception e){ - System.out.println(e.getMessage()); - } - - return 0; - } - - - public Move generateHumanPlayFromBlackSide(Board board){ - List intPos = new ArrayList<>(); - Random random = new Random(); - HashMap generator = new HashMap<>(); - - - for (int i = 0; i < board.legalMoves().size(); i++) { - int indexPicker = random.nextInt(0, 65); - intPos.add(Integer.valueOf(indexPicker)); - } - - - for (int j = 0; j < board.legalMoves().size(); j++) { - generator.put(intPos.get(j), board.legalMoves().get(j)); - } - - Collections.shuffle(intPos); - Collections.rotate(intPos, 2); - - - return generator.get(intPos.get(new Random().nextInt(intPos.size()))); - } - - - - public Move generateMoveFromIndexLookUp(Board board){ - - try { - - if (board.getSideToMove().equals(Side.WHITE)) { - for(Move m: board.legalMoves()){ - if(board.getContext().isCastleMove(m)){ - return m; - } - } - - if(board.getSideToMove().equals(Side.WHITE)){ - Board boardCheckMate = board.clone(); - for(Move m: board.legalMoves()){ - boardCheckMate.doMove(m); - if(boardCheckMate.isMated()){ - return m; - } - boardCheckMate.undoMove(); - } - } - - return LocalfindBestMove(board, 14); - } else if (board.getSideToMove().equals(Side.BLACK)) { - - return generateHumanPlayFromBlackSide(board); - } - }catch (Exception e){ - System.out.println(e.getMessage()); - return null; - - } - - return null; - - - } - - - public Move LocalfindBestMove(Board board, int depth) { - - - // Adjust the search depth as needed - int bestValue = Integer.MIN_VALUE; - Move bestMove = null; - for (Move move : board.legalMoves()) { - board.doMove(move); - int value = negamaxlocal(depth - 1, Integer.MAX_VALUE, Integer.MIN_VALUE, board); - board.undoMove(); - if (value > bestValue) { - bestValue = value; - bestMove = move; - } - } - - try { - - return bestMove; - - - }catch (Exception e){ - System.out.println(e.getMessage()); - return board.legalMoves().get(0); - } - - - - } - - - private int negamaxlocal(int depth, int alpha, int beta, Board board) { - if (depth == 0 || board.isMated() || board.isDraw()) { - - return evaluateBoard(board); - } - int bestValue = Integer.MIN_VALUE; - for (Move move : board.legalMoves()) { - board.doMove(move); - int value = negamaxlocal(depth - 1, -beta, -alpha, board); - board.undoMove(); - bestValue = Math.max(bestValue, value); - alpha = Math.max(alpha, value); - if (alpha >= beta) { - break; - } - } - - - return bestValue; - } - - - public Move findBestMove() { - - - int depth = 5; - int bestValue = Integer.MIN_VALUE; - Move bestMove = null; - for (Move move : MoveGenerator.generateLegalMoves(this.board)) { - this.board.doMove(move); - int value = negamax(depth - 1, Integer.MAX_VALUE, Integer.MIN_VALUE); - this.board.undoMove(); - if (value > bestValue) { - bestValue = value; - bestMove = move; - } - } - - - return bestMove; - - } - - - - private int negamax(int depth, int alpha, int beta) { - if (depth == 0 || this.board.isMated() || this.board.isDraw()) { - - return evaluate(); - } - int bestValue = Integer.MIN_VALUE; - for (Move move : MoveGenerator.generateLegalMoves(this.board)) { - this.board.doMove(move); - int value = negamax(depth - 1, -beta, -alpha); - this.board.undoMove(); - bestValue = Math.max(bestValue, value); - alpha = Math.max(alpha, value); - if (alpha >= beta) { - break; - } - } - - - return bestValue; - } - - - - - - private int evaluate() { - int score = 0; - - score -= 64; - - score += this.board.legalMoves().size(); - - - if(board.getSideToMove().equals(Side.WHITE)){ - return score * 1; - }else{ - return score * -1; - } - - } - - - public void resetBoard(){ - this.board = new Board(); - } - - - - public String getImageOfCurrentBoard(){ - ChessUtil chessUtil = new ChessUtil(); - return chessUtil.getImageFromFEN(this.board.getFen()); - } - - - -} diff --git a/src/main/java/Controller/LiveStreamers.java b/src/main/java/Controller/LiveStreamers.java deleted file mode 100644 index 9b4ab21..0000000 --- a/src/main/java/Controller/LiveStreamers.java +++ /dev/null @@ -1,66 +0,0 @@ -import chariot.Client; -import chariot.model.*; -import net.dv8tion.jda.api.EmbedBuilder; - -import java.awt.*; -import java.util.List; -import java.util.Optional; - -public class LiveStreamers { - - - private final Client client; - private EmbedBuilder embedBuilder; - - public LiveStreamers(Client client){ - this.client = client; - } - - public EmbedBuilder getTv(){ - - List live = client.users().liveStreamers().stream().toList(); - - this.embedBuilder = new EmbedBuilder(); - - String getLivePeople = ""; - - - for(int i = 0; i < 3; i++){ - - String title = live.get(i).user().title().orElse(""); - - String presentlink = ""; - String TwitchLink = ""; - String YoutubeLink = ""; - - if(live.get(i).stream().service().equals("twitch")){ - if (live.get(i).streamer().twitch() instanceof Some twitch) { - TwitchLink = twitch.value(); - presentlink += "[**Twitch** \uD83D\uDD2E ](" + TwitchLink + ") " + "**"+ live.get(i).streamer().headline() + "**"+ "\n\n"; - } - }else{ - if (live.get(i).streamer().youtube() instanceof Some youtube) { - YoutubeLink = youtube.value(); - presentlink += "[**Youtube** \uD83D\uDD3A ](" + YoutubeLink + ") " + "**"+ live.get(i).streamer().headline() + "**"+ "\n\n"; - } - } - - - getLivePeople +=" \uD83C\uDF99️ " + title + " **" + live.get(i).user().id() + "**" + " is **Live**! \n " + presentlink; - - - } - this.embedBuilder.setThumbnail("https://media2.giphy.com/media/McsDYx2ihXzztTFMap/giphy.gif"); - this.embedBuilder.setTitle("Current Live Streamers: "); - this.embedBuilder.setColor(Color.pink); - this.embedBuilder.setDescription(getLivePeople); - - return this.embedBuilder; - - - } - - - - -} diff --git a/src/main/java/Controller/Main.java b/src/main/java/Controller/Main.java deleted file mode 100644 index 6811c48..0000000 --- a/src/main/java/Controller/Main.java +++ /dev/null @@ -1,82 +0,0 @@ - - -import net.dv8tion.jda.api.JDA; -import net.dv8tion.jda.api.JDABuilder; -import net.dv8tion.jda.api.OnlineStatus; -import net.dv8tion.jda.api.entities.Activity; -import net.dv8tion.jda.api.hooks.ListenerAdapter; -import net.dv8tion.jda.api.interactions.commands.Command; -import net.dv8tion.jda.api.interactions.commands.OptionType; -import net.dv8tion.jda.api.interactions.commands.build.Commands; -import net.dv8tion.jda.api.requests.restaction.CommandListUpdateAction; - - -public class Main extends ListenerAdapter { - - private static JDABuilder jdaBuilder; - private static JDA jda; - - - public static void main(String[] args) { - - - jdaBuilder = JDABuilder.createDefault(System.getenv("discord_bot_token")); - - jdaBuilder.setStatus(OnlineStatus.ONLINE); - - jdaBuilder.setActivity(Activity.playing("/help")); - - jdaBuilder.addEventListeners(new Main()); - jdaBuilder.addEventListeners(new CommandHandler()); - - - try { - jda = jdaBuilder.build(); - - } catch (Exception exception) { - exception.printStackTrace(); - } - - CommandListUpdateAction commands = jda.updateCommands(); - commands.addCommands(Commands.slash("dailypuzzlecc", "do chess.com daily puzzles")); - commands.addCommands(Commands.slash("community", "Best chess Discord communities!")); - commands.addCommands(Commands.slash("broadcast", "View Latest OTB/Online Master tournament")); - commands.addCommands(Commands.slash("profilecc", "view cc profiles")); - commands.addCommands(Commands.slash("service", "Read our Terms of Service")); - commands.addCommands(Commands.slash("suggest", "provide suggestion").addOption(OptionType.STRING, "suggestid", "provide feedback/feature request", true)); - commands.addCommands(Commands.slash("dailypuzzle", "Daily Lichess Puzzles")); - commands.addCommands(Commands.slash("arena", "See Swiss/Arena standings").addOption(OptionType.STRING, "arenaid", "Input Lichess arena link", true)); - commands.addCommands(Commands.slash("watchmaster", "Watch GM Games in gif")); - commands.addCommands(Commands.slash("profile", "See Lichess Profile of given user")); - commands.addCommands(Commands.slash("streamers", "See current Live Streamers")); - commands.addCommands(Commands.slash("puzzle", "do puzzles")); - commands.addCommands(Commands.slash("help", "View LISEBOT Commands")); - commands.addCommands(Commands.slash("play", "Play Live Chess Games")); - commands.addCommands(Commands.slash("playvariant", "Play variant chess (3check, chess960, atomic)")); - commands.addCommands(Commands.slash("watch", "Watch Lichess games for given user")); - commands.addCommands(Commands.slash("invite", "Invite me to your servers!")); - commands.addCommands(Commands.slash("move", "make a move").addOption(OptionType.STRING, "play-move", "input chess move", true)); - commands.addCommands(Commands.slash("resetboard", "reset the board")); - commands.addCommands(Commands.slash("answer", "check solution for daily puzzle").addOption(OptionType.STRING, "daily-puzzle-answer", "Answer daily puzzle with chess notation", true)); - - - - commands.addCommands(Commands.context(Command.Type.MESSAGE, "Lichess Daily Puzzle")); - commands.addCommands(Commands.context(Command.Type.MESSAGE, "Play Chess")); - commands.addCommands(Commands.context(Command.Type.MESSAGE, "View Lichess Broadcasts")); - commands.addCommands(Commands.context(Command.Type.MESSAGE, "Watch GMs")); - commands.addCommands(Commands.context(Command.Type.MESSAGE, "Chess.com Daily Puzzle")); - - - commands.queue(); - - LichessBotRunner.main(args); - - - - } - - - - -} diff --git a/src/main/java/Controller/SwissResults.java b/src/main/java/Controller/SwissResults.java deleted file mode 100644 index 9562bb0..0000000 --- a/src/main/java/Controller/SwissResults.java +++ /dev/null @@ -1,59 +0,0 @@ -import chariot.Client; -import chariot.model.Many; -import chariot.model.One; -import chariot.model.Swiss; -import chariot.model.SwissResult; -import net.dv8tion.jda.api.EmbedBuilder; - -import java.awt.*; -import java.util.List; - -public class SwissResults { - - private final Client client; - private final String link; - - public SwissResults(Client client, String link){ - this.client = client; - this.link = link; - } - - - public EmbedBuilder getLinkResults(){ - EmbedBuilder embedBuilder = new EmbedBuilder(); - - String[] emojileaderboard = {"1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "\uD83D\uDD1F"}; - String[] podium = {"\uD83C\uDFC6", "\uD83E\uDD48", "\uD83E\uDD49"}; - String res = ""; - String info = ""; - String podiumres = ""; - - - - Many swissResultResult = this.client.tournaments().resultsBySwissId(this.link); - One result = this.client.tournaments().swissById(this.link); - - if(result.isPresent()){ - info += "**Total Players:** " + result.get().nbPlayers() + "\n" + "**Total Rounds:** " + result.get().nbRounds() + "\n **Name Rating Score Tiebreak**\n\n"; - List list = swissResultResult.stream().toList(); - for(int i = 0; i < 3 ; i++){ - podiumres += podium[i] + " "+ list.get(i).username() + " " + list.get(i).rating() + " **" + list.get(i).points() + "** " + list.get(i).tieBreak() + "\n"; - } - - for(int i = 0; i < 10 ; i++){ - res += emojileaderboard[i] + " "+ list.get(i).username() + " " + list.get(i).rating() + " **" + list.get(i).points() + "** " + list.get(i).tieBreak() + "\n"; - } - embedBuilder.setColor(Color.green); - embedBuilder.setDescription( info + "\n\n **Podium** \n" + podiumres + "\n\n" + res ); - embedBuilder.setTitle(result.get().name()); - - } - - return embedBuilder; - - - } - - - -} diff --git a/src/main/java/Controller/UserArena.java b/src/main/java/Controller/UserArena.java deleted file mode 100644 index 4be30eb..0000000 --- a/src/main/java/Controller/UserArena.java +++ /dev/null @@ -1,129 +0,0 @@ -import chariot.Client; -import chariot.model.Arena; -import chariot.model.One; -import chariot.model.Swiss; -import net.dv8tion.jda.api.EmbedBuilder; - -import java.awt.*; -import java.util.List; - -public class UserArena { - - private final Client client; - private EmbedBuilder embedBuilder; - private final String arenaID; - - public UserArena(Client client, String arenaID) { - this.client = client; - this.arenaID = arenaID; - } - - - - - public EmbedBuilder getUserArena() { - - try { - - String[] spliturl = this.arenaID.split("tournament/"); - this.embedBuilder = new EmbedBuilder(); - String[] emojileaderboard = {"1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "\uD83D\uDD1F"}; - String[] podium = {"\uD83C\uDFC6", "\uD83E\uDD48", "\uD83E\uDD49"}; - - String touryID = ""; - - for (String a : spliturl) { - - touryID = a; - - } - - - - One arenaResult1 = client.tournaments().arenaById(touryID); - - if (arenaResult1.isPresent() && spliturl[0].startsWith("http") && spliturl[0].contains("lichess")) { - - Arena arena = arenaResult1.get(); - - - - String name = arena.fullName(); - - int numPlayers = arena.nbPlayers(); - - int timeLeft = arena.minutes(); - - Arena.Perf perf = arena.perf(); - - String perfname = perf.name(); - - String stand = ""; - String standPodium = ""; - - - Arena.Standing standing = arena.standing(); - - - - - List players = standing.players(); - - for (int i = 0; i < 3; i++) { - - standPodium += podium[i] + " " + players.get(i).name() + " " + players.get(i).rating() + " **" + players.get(i).score() + "** " + players.get(i).team() + "\n "; - - - } - - - for (int i = 0; i < players.size(); i++) { - - stand += emojileaderboard[i] + " " + players.get(i).name() + " " + players.get(i).rating() + " **" + players.get(i).score() + "** " + players.get(i).team() + "\n "; - - - } - - - this.embedBuilder = new EmbedBuilder(); - this.embedBuilder.setColor(Color.green); - this.embedBuilder.setTitle( "\uD83C\uDF96️ " + name + " \uD83C\uDF96️"); - this.embedBuilder.setDescription("** Tournament Name:** " + name + "\n **Variant:** " + perfname + "\n **Time Duration :** " + timeLeft + " mins" + "\n **Total Players:** " + numPlayers + "\n **Standings:**" + "\n **Rank** **Username** **Rating:** **Score** \n \n " + " **Podium** \n " + standPodium + "\n\n **Leaderboard** \n" + stand + "\n" + "[View on Lichess](" + this.arenaID + ")"); - - - }else{ - this.embedBuilder = new EmbedBuilder(); - String[] splitswiss = this.arenaID.split("swiss/"); - - String touryIDSwiss = ""; - - for (String a : splitswiss) { - - touryIDSwiss = a; - - } - - - One swissResult = this.client.tournaments().swissById(touryIDSwiss); - - if(swissResult.isPresent()){ - SwissResults swissResults = new SwissResults(client, touryIDSwiss); - return swissResults.getLinkResults(); - } - - return this.embedBuilder.setDescription("Error occurred, please provide valid Lichess URL"); - } - - }catch (Exception e){ - e.printStackTrace(); - this.embedBuilder = new EmbedBuilder(); - return this.embedBuilder.setDescription("Error occurred, please provide valid Lichess arena url"); - } - - return this.embedBuilder; - - - } - - -} diff --git a/src/main/java/Controller/UserGame.java b/src/main/java/Controller/UserGame.java deleted file mode 100644 index 3107ba9..0000000 --- a/src/main/java/Controller/UserGame.java +++ /dev/null @@ -1,65 +0,0 @@ -import chariot.Client; -import chariot.model.Game; - - - -public class UserGame { - - - private final Client client; - private final String getUserID; - - private String gamelinkId = new String(""); - - - - public UserGame(Client client, String userID){ - this.client = client; - this.getUserID = userID.toLowerCase(); - - } - - public boolean isBlack(){ - - return this.client.games().currentByUserId(this.getUserID).get().players().black().name().equalsIgnoreCase(this.getUserID); - - } - - - - - public String getUserGames() { - - - - - Game getGame = this.client.games().currentByUserId(this.getUserID).get(); - - - if (isBlack()) { - gamelinkId += "https://lichess1.org/game/export/gif/black/" + getGame.id() + ".gif?theme=green&piece=alpha"; - - } else { - gamelinkId += "https://lichess1.org/game/export/gif/white/" + getGame.id() + ".gif?theme=green&piece=alpha"; - - } - - - - return gamelinkId; - - - - } - - - - - public Client getClient(){ - return this.client; - } - - - - -} diff --git a/src/main/java/Controller/UserProfile.java b/src/main/java/Controller/UserProfile.java deleted file mode 100644 index d4fb253..0000000 --- a/src/main/java/Controller/UserProfile.java +++ /dev/null @@ -1,192 +0,0 @@ -import chariot.Client; -import chariot.model.Enums; -import chariot.model.One; -import chariot.model.PerformanceStatistics; -import chariot.model.ProvidedProfile; -import chariot.model.Some; -import chariot.model.User; - -import java.util.List; -import java.util.Optional; - -public class UserProfile extends UserObject{ - - - private String sayProfile = new String(""); - - public UserProfile(Client client, String userParsing){ - super(client, userParsing); - - } - - - - - public String getBlitzRatings(){ - One userBlitz = this.getClient().users().performanceStatisticsByIdAndType(this.getUserID(), Enums.PerfType.blitz); - - - String blitzRating = " \uD83D\uDD25 **Blitz**: ?"; - - if(userBlitz.isPresent() && !userBlitz.get().perf().glicko().provisional()){ - return blitzRating = " \uD83D\uDD25 **Blitz**: " + userBlitz.get().perf().glicko().rating().intValue(); - } - - return blitzRating; - - } - - public String getRapidRatings(){ - One userRapid = this.getClient().users().performanceStatisticsByIdAndType(this.getUserID(), Enums.PerfType.rapid); - - String rapidRating = " \uD83D\uDC07 **Rapid**: ?"; - - if(userRapid.isPresent() && !userRapid.get().perf().glicko().provisional()){ - return rapidRating = "\uD83D\uDC07 **Rapid**: " + userRapid.get().perf().glicko().rating().intValue(); - } - - return rapidRating; - - } - - public String getBulletRatings(){ - One userBullet = this.getClient().users().performanceStatisticsByIdAndType(this.getUserID(), Enums.PerfType.bullet); - - String bulletRating = "\uD83D\uDD2B **Bullet**: ?"; - - if(userBullet.isPresent() && !userBullet .get().perf().glicko().provisional()){ - return bulletRating = "\uD83D\uDD2B **Bullet**: " + userBullet .get().perf().glicko().rating().intValue(); - } - - return bulletRating; - - } - - public String getClassicalRatings(){ - One usercal = this.getClient().users().performanceStatisticsByIdAndType(this.getUserID(), Enums.PerfType.classical); - - String calRating = "\uD83D\uDC22 **Classical**: ?"; - - if(usercal.isPresent() && !usercal.get().perf().glicko().provisional()){ - return calRating = "\uD83D\uDC22 **Classical**: " +usercal.get().perf().glicko().rating().intValue(); - } - - return calRating; - - } - - - - - public String getUserProfile(){ - - try { - - One userResult = this.getClient().users().byId(this.getUserID(), params -> params.withTrophies(true)); - - - - boolean userPresent = userResult.isPresent(); - - - - if (userPresent == true) { - User user = userResult.get(); - String StatusEmoji = "\uD83D\uDD34"; - boolean checkOnline = this.getClient().users().statusByIds(this.getUserID()).stream().toList().get(0).online(); - if(checkOnline){ - StatusEmoji = "\uD83D\uDFE2"; - } - - - - - boolean cheater = user.tosViolation(); - - boolean closedaccount = user.disabled(); - - if (cheater == true) { - return " This user has violated Lichess Terms of Service"; - - } - if (closedaccount == true) { - return "This account is closed"; - - } - - - if (cheater == false && closedaccount == false) { - - ProvidedProfile profile = user.profile(); - - String name = user.id(); - - String bio = profile.bio().orElse(""); - - int wins = user.accountStats().win(); - - int lose = user.accountStats().loss(); - - int all = user.accountStats().all(); - - int draw = user.accountStats().draw(); - - int playing = user.accountStats().playing(); - - String userUrl = user.url().toURL().toString(); - - - - boolean pat = user.patron(); - - String patWings = ""; - - String sayTitle = user.title().orElse(""); - - Boolean hasTitle = user.title() instanceof Some; - - String sayrewards = ""; - String embedRewards = ""; - - List trophies = user.trophies().orElse(List.of()); - - for (chariot.model.Trophy trophy : trophies) { - - UserTrophy userTrophy = new UserTrophy(trophy); - sayrewards += userTrophy.getImageLink() + "\n"; - } - - if(!trophies.isEmpty()) { - - embedRewards += "\n\n ** \uD83D\uDCA0 Trophies:** \n\n" + sayrewards; - - }else{ - embedRewards += ""; - } - - - this.sayProfile += sayTitle + " " + name + " " +StatusEmoji + "\n" +"**All Games**: " + all + "\n" + "** ⚔️ Won:** " + wins + " ** \uD83D\uDE14 Loss:** " + lose + " ** \uD83E\uDD1D Draw:** " + draw + "\n** ♗ Playing:** " + playing + "\n \uD83D\uDCB9 **Ratings**: \n" + this.getBlitzRatings() + "\n" + this.getRapidRatings() + "\n" + this.getBulletRatings() + "\n" + this.getClassicalRatings()+ embedRewards ; - } - } - if (userPresent == false) { - return "User Not Present, Please try again"; - - } - - }catch(Exception e){ - e.printStackTrace(); - return "Unknown Error.."; - } - - return sayProfile; - - - } - - - - - - - -} diff --git a/src/main/java/Controller/WatchMaster.java b/src/main/java/Controller/WatchMaster.java deleted file mode 100644 index 226682a..0000000 --- a/src/main/java/Controller/WatchMaster.java +++ /dev/null @@ -1,80 +0,0 @@ -import chariot.Client; -import chariot.model.ExploreResult; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - - -public class WatchMaster { - - private final Client client; - private String masterGif; - private String openingGif; - - - public WatchMaster(Client client){ - this.client = client; - this.masterGif = ""; - this.openingGif = ""; - - } - - - - - public String getMasterGames(){ - - String e4games = ""; - String d4games = ""; - String Nf3games = ""; - String c4games = ""; - List masterGifs = new ArrayList<>(); - Random random = new Random(); - - - - List gamesE4 = chariot.Client.basic().openingExplorer().masters(conf -> conf.play("e2e4")).get().topGames(); - List gamesD4 = chariot.Client.basic().openingExplorer().masters(conf -> conf.play("d2d4")).get().topGames(); - List gamesNf3 = chariot.Client.basic().openingExplorer().masters(conf -> conf.play("g1f3")).get().topGames(); - List gamesc4 = chariot.Client.basic().openingExplorer().masters(conf -> conf.play("c2c4")).get().topGames(); - - - - int randome4size = random.nextInt(gamesE4.size()); - int randomd4size = random.nextInt(gamesD4.size()); - int randomnf3size = random.nextInt(gamesNf3.size()); - int randomc4size = random.nextInt(gamesc4.size()); - - - e4games += "https://lichess1.org/game/export/gif/" + gamesE4.get(randome4size).id() + ".gif"; - d4games += "https://lichess1.org/game/export/gif/" + gamesD4.get(randomd4size).id() + ".gif"; - Nf3games += "https://lichess1.org/game/export/gif/" + gamesNf3.get(randomnf3size).id() + ".gif"; - c4games += "https://lichess1.org/game/export/gif/" + gamesc4.get(randomc4size).id() + ".gif"; - - masterGifs.add(e4games); - masterGifs.add(d4games); - masterGifs.add(Nf3games); - masterGifs.add(c4games); - - int gifrandom = random.nextInt(4); - - this.masterGif = masterGifs.get(gifrandom); - - - return masterGif; - } - - - - public String[] getGameId(){ - String[] split = this.masterGif.split(".gif"); - return split; - } - - - - - - -} diff --git a/src/main/java/Controller/puzzle.java b/src/main/java/Controller/puzzle.java deleted file mode 100644 index 287ffea..0000000 --- a/src/main/java/Controller/puzzle.java +++ /dev/null @@ -1,78 +0,0 @@ -import io.github.sornerol.chess.pubapi.client.DailyPuzzleClient; -import io.github.sornerol.chess.pubapi.exception.ChessComPubApiException; -import java.io.IOException; - - -public class puzzle extends ChessPuzzle{ - - private final DailyPuzzleClient dailyPuzzleClient = this.getDailyPuzzleClient(); - - private String moveSay = ""; - private String solLink = ""; - - - - - - public puzzle(){ - super(); - } - - @Override - public String getPuzzle() { - try { - - - String cor = this.dailyPuzzleClient.getRandomDailyPuzzle().getFen(); - - String[] split = cor.split(" "); - - String coordImg = ""; - - if(split[1].contains("w")){ - moveSay += "White To Move"; - - }else{ - moveSay += "Black To Move"; - - } - - - if(split[1].contains("w")){ - coordImg = "https://lichess1.org/export/fen.gif?fen=" + split[0] + "&color=white&theme=brown&piece=kosal"; - }else{ - coordImg = "https://lichess1.org/export/fen.gif?fen=" + split[0] + "&color=black&theme=brown&piece=kosal"; - } - - - this.solLink += "https://lichess.org/analysis/standard/" + cor.replace(" ", "_"); - - - return coordImg; - - - - } catch (IOException | ChessComPubApiException e) { - e.printStackTrace(); - return "loading.."; - } - } - - @Override - public String getSolution() { - return null; - } - - @Override - public String getPuzzleURL() { - return solLink; - } - - @Override - public String getPuzzleSideToMove() { - return moveSay; - } - - - -} diff --git a/src/main/java/Model/ChessPuzzle.java b/src/main/java/Model/ChessPuzzle.java deleted file mode 100644 index 44f44c3..0000000 --- a/src/main/java/Model/ChessPuzzle.java +++ /dev/null @@ -1,64 +0,0 @@ -import chariot.Client; -import com.github.bhlangonijr.chesslib.Board; -import io.github.sornerol.chess.pubapi.client.DailyPuzzleClient; -import net.dv8tion.jda.api.EmbedBuilder; - -public abstract class ChessPuzzle { - - - private final DailyPuzzleClient dailyPuzzleClient; - private final Client client; - private final Board board; - - public ChessPuzzle(){ - this.client = Client.basic(); - this.dailyPuzzleClient = new DailyPuzzleClient(); - this.board = new Board(); - } - - public ChessPuzzle(Client client, Board board){ - this.client = client; - this.dailyPuzzleClient = new DailyPuzzleClient(); - this.board = new Board(); - } - - public ChessPuzzle(DailyPuzzleClient client, Board board){ - this.dailyPuzzleClient = client; - this.client = Client.basic(); - this.board = new Board(); - - } - - - public abstract String getPuzzle(); - - public abstract String getSolution(); - - public abstract String getPuzzleURL(); - - public EmbedBuilder getThemes(){ - return null; - } - - public abstract String getPuzzleSideToMove(); - - public boolean checkSolution(String answer){ - return false; - } - - public Client getClient() { - return client; - } - - public DailyPuzzleClient getDailyPuzzleClient() { - return dailyPuzzleClient; - } - - public Board getBoard() { - return board; - } - - public int getRating(){ - return 0; - } -} diff --git a/src/main/java/Model/UserDashboard.java b/src/main/java/Model/UserDashboard.java deleted file mode 100644 index 34e126b..0000000 --- a/src/main/java/Model/UserDashboard.java +++ /dev/null @@ -1,107 +0,0 @@ -import chariot.Client; -import chariot.model.One; -import chariot.model.StormDashboard; -import chariot.model.User; -import net.dv8tion.jda.api.EmbedBuilder; - -import java.awt.*; -import java.util.List; -import java.util.Optional; - -public class UserDashboard extends UserProfile{ - - private EmbedBuilder embedBuilder; - - public UserDashboard(Client client, String userParsing) { - super(client, userParsing); - } - - - - public EmbedBuilder getUserDashboard(){ - - - - One userResult = this.getClient().users().byId(this.getUserID()); - this.embedBuilder = new EmbedBuilder(); - - - - if(userResult.isPresent() && !userResult.get().disabled() && !userResult.get().tosViolation()){ - - User user = userResult.get(); - - String title = user.title().orElse(""); - - One dash = this.getClient().puzzles().stormDashboard(this.getUserID()); - - String dashs = ""; - - if (dash.isPresent()) { - - StormDashboard dashboard = dash.get(); - - List day = dashboard.days(); - - if(day.isEmpty()){ - this.embedBuilder = new EmbedBuilder(); - this.embedBuilder.setColor(Color.red); - return this.embedBuilder.setDescription("This User has not played enough storm puzzles to calculate the dashboard"); - } - - StormDashboard.High high = dashboard.high(); - - int allTime = high.allTime(); - - int month = high.month(); - - int week = high.week(); - - int today = high.day(); - - String link = "https://lichess.org/storm/dashboard/" + this.getUserID(); - - - for(int i = 0; i < 1; i++){ - - dashs += " Date: " + day.get(i)._id() + " Runs: " + day.get(i).runs() + " Score: " + day.get(i).score() + " Best Puzzle Solved: " + day.get(i).highest() + "\n"; - - - } - String todayAns = ""; - - if(today == 0){ - todayAns += "No stormdash was played today"; - }else{ - todayAns += today; - } - - this.embedBuilder = new EmbedBuilder(); - this.embedBuilder.setColor(Color.orange); - this.embedBuilder.setThumbnail("https://prismic-io.s3.amazonaws.com/lichess/4689c1c3-092d-46f9-b554-ca47e91c7d81_storm-yellow.png"); - this.embedBuilder.setTitle("StormDashboard for: " + title + " " + this.getUserID()); - this.embedBuilder.setDescription(" All Time High score: **" + allTime + "** \n \n This Month: **" + month + "\n\n **This Week: **" + week + "** \n \n **Today:** " + todayAns + "\n\n **Storm History:** \n \n" + dashs + "\n\n [View on Lichess](" + link + ")"); - - - - - }else{ - this.embedBuilder = new EmbedBuilder(); - this.embedBuilder.setColor(Color.red); - return this.embedBuilder.setDescription("This User has not played enough storm puzzles to calculate the dashboard"); - } - - }else{ - this.embedBuilder = new EmbedBuilder(); - this.embedBuilder.setColor(Color.red); - return this.embedBuilder.setDescription("User not present"); - } - - - return this.embedBuilder; - - } - - - -} diff --git a/src/main/java/Model/UserObject.java b/src/main/java/Model/UserObject.java deleted file mode 100644 index 5c9c845..0000000 --- a/src/main/java/Model/UserObject.java +++ /dev/null @@ -1,28 +0,0 @@ -import chariot.Client; -import net.dv8tion.jda.api.EmbedBuilder; - -public class UserObject { - - private Client client; - private EmbedBuilder embedBuilder; - private String userID; - - - public UserObject(Client client, String userParsing){ - this.client = client; - this.userID = userParsing.toLowerCase().trim(); - } - - - public Client getClient(){ - return this.client; - } - - public String getUserID(){ - return this.userID; - } - - - - -} diff --git a/src/main/java/Model/UserTrophy.java b/src/main/java/Model/UserTrophy.java deleted file mode 100644 index 45427ef..0000000 --- a/src/main/java/Model/UserTrophy.java +++ /dev/null @@ -1,65 +0,0 @@ -import chariot.model.Trophy; - -import java.util.HashMap; - -public class UserTrophy { - - private final String trophyName; - private Trophy trophy; - - - - public UserTrophy(Trophy trophy){ - - this.trophy = trophy; - this.trophyName = trophy.name(); - - } - - - public String getImageLink(){ - - - HashMap getLink = new HashMap<>(); - - - getLink.put("Marathon Winner", "\uD83D\uDD2E"); - getLink.put("Marathon Top 10", "\uD83C\uDF15"); - getLink.put("Other","\uD83C\uDFC6"); - getLink.put("Verified account", "✅"); - getLink.put("Lichess moderator", "\uD83D\uDC41️" ); - getLink.put("Lichess content team","✍️"); - getLink.put("Lichess developer", "\uD83D\uDEE0️"); - - - - String imageLink; - if(this.trophyName.equals("Marathon Winner")){ - imageLink = getLink.get("Marathon Winner"); - } - else if(this.trophyName.equals("Marathon Top 10")){ - imageLink = getLink.get("Marathon Top 10"); - } - else if(!this.trophyName.equals("Verified account") && !this.trophyName.equals("Lichess moderator") && !this.trophyName.equals("Lichess content team") && !this.trophyName.equals("Lichess developer")){ - imageLink = getLink.get("Other"); - } - else if(this.trophyName.equals("Verified account")){ - imageLink = getLink.get("Verified account"); - } - else if(this.trophyName.equals("Lichess moderator")){ - imageLink = getLink.get("Lichess moderator"); - }else if(this.trophyName.equals("Lichess content team")){ - imageLink = getLink.get("Lichess content team"); - }else { - imageLink = getLink.get("Lichess developer"); - } - - - return imageLink+ " " + this.trophyName; - - - - } - - -} diff --git a/src/main/java/View/CommandInfo.java b/src/main/java/View/CommandInfo.java deleted file mode 100644 index 739c709..0000000 --- a/src/main/java/View/CommandInfo.java +++ /dev/null @@ -1,54 +0,0 @@ -import net.dv8tion.jda.api.EmbedBuilder; - -import java.awt.*; - -public class CommandInfo { - - private EmbedBuilder embedBuilder; - private final String logo = "https://static-00.iconduck.com/assets.00/lichess-icon-512x512-q0oh5bwk.png"; - private final String[] Emojis = {"❓", "\uD83E\uDDE9", "\uD83D\uDC64", "\uD83C\uDFA4", "\uD83D\uDCDA", "\uD83C\uDFC6", "⚔️"}; - public CommandInfo(){ - this.embedBuilder = new EmbedBuilder(); - } - - - public EmbedBuilder getPageOne(){ - this.embedBuilder.setColor(Color.blue); - this.embedBuilder.setTitle("**Commands For LISEBOT**"); - this.embedBuilder.setThumbnail(this.logo); - this.embedBuilder.setDescription("**" + Emojis[0] + " /help** \n to see command information for the LISEBOT" + "\n\n**" + Emojis[0] + " /suggest** \n provide feedback to developer" + "\n\n**" +Emojis[1] +" /dailypuzzlecc** \n view Chess.com daily puzzles" + "\n\n **" + Emojis[2] + " /profilecc** \n view Chess.com profiles" +"\n\n **" + Emojis[2] +" /profile ** \n to see lichess profiles for given username" + "\n\n **" + Emojis[3] +" /streamers** \n Watch current live streamers"); - this.embedBuilder.setFooter("Page 1/3", this.logo); - - - return this.embedBuilder; - } - - - public EmbedBuilder getPageTwo(){ - this.embedBuilder.setColor(Color.blue); - this.embedBuilder.setTitle("**Puzzles And Tournaments**"); - this.embedBuilder.setThumbnail(this.logo); - //this.embedBuilder.setThumbnail("https://images.prismic.io/lichess/25a60c33-96ad-4fd1-b9b2-dca8e289961f_lichesslogo.png?auto=compress,format"); - this.embedBuilder.setDescription("\n\n**" + Emojis[1] + " /dailypuzzle** \n see the daily Lichess puzzle and try to solve it!" + "\n\n **" + Emojis[1] + " /puzzle** \n Do Random Chess Puzzles" + "\n\n**" + Emojis[5] +" /arena ** \n see the standings and tournament information for given tournament link" + "\n\n **" + Emojis[5] +" /tourney**\n View Current Lichess Tournaments"); - this.embedBuilder.setFooter("Page 2/3", this.logo); - return this.embedBuilder; - } - - - - public EmbedBuilder getPageThree(){ - this.embedBuilder.setColor(Color.blue); - this.embedBuilder.setTitle("**Watch And Play Chess**"); - this.embedBuilder.setThumbnail(this.logo); - //this.embedBuilder.setThumbnail("https://images.prismic.io/lichess/25a60c33-96ad-4fd1-b9b2-dca8e289961f_lichesslogo.png?auto=compress,format"); - this.embedBuilder.setDescription( "\n\n **" + Emojis[0] +" /invite** \n invite LiSEBot to your servers" + "\n\n **" +Emojis[6]+" /play ** \n Play chess with friends/BOTS on Lichess.org" + "\n\n **" +Emojis[6]+" /playvariant ** \n Play chess variants [atomic/3check/960] with friends/BOTS on Lichess.org" + "\n\n **"+ Emojis[6] + " /community ** \n view chess community"+ "\n\n **" +"\uD83D\uDCFA"+" /watch** \n watch latest Lichess game of the given user in gif!" + "\n\n **" +"\uD83D\uDCFA"+ " /watchgame** \n watch Lichess games for given Lichess link" +"\n\n **" +"\uD83D\uDCFA"+ " /watchmaster** \n watch random master games" + "\n\n **" +Emojis[5]+" /broadcast** \n view current ongoing master OTB/Online tournament" - + "\n\n **" + Emojis[6] + "/move ** \n play chess with Lise chess engine [/resetboard] to start/end the game"); - this.embedBuilder.setFooter("Page 3/3", this.logo); - return this.embedBuilder; - } - - - - - -} diff --git a/src/main/java/View/InviteMe.java b/src/main/java/View/InviteMe.java deleted file mode 100644 index 5732819..0000000 --- a/src/main/java/View/InviteMe.java +++ /dev/null @@ -1,27 +0,0 @@ -import net.dv8tion.jda.api.EmbedBuilder; - -import java.awt.*; - -public class InviteMe { - - private EmbedBuilder embedBuilder; - - public InviteMe(){ - this.embedBuilder = new EmbedBuilder(); - } - - public EmbedBuilder getInviteInfo(){ - this.embedBuilder = new EmbedBuilder(); - this.embedBuilder.setColor(Color.orange); - this.embedBuilder.setTitle("Invite me and Join our Discord Server!"); - this.embedBuilder.setDescription("\uD83D\uDC4B [Click here for invite me](https://discord.com/api/oauth2/authorize?client_id=930544707300393021&permissions=277025704000&scope=bot%20applications.commands) \n\n \uD83D\uDC4D [Vote me on top.gg](https://top.gg/bot/930544707300393021/vote) \n\n \uD83D\uDEE0️ [Join Support Server](https://discord.com/invite/6GdGqwxBdW) "); - - - - return this.embedBuilder; - } - - - - -}