From 93a0320b6f9693b5aaf8c645bc6572634da580b6 Mon Sep 17 00:00:00 2001 From: mavlonerkinboev Date: Sat, 24 Jul 2021 14:01:33 +0500 Subject: sixteenth commit --- src/main/java/files/Bot.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/main/java/files/Bot.java') diff --git a/src/main/java/files/Bot.java b/src/main/java/files/Bot.java index 55eff9b..dcbb64a 100644 --- a/src/main/java/files/Bot.java +++ b/src/main/java/files/Bot.java @@ -6,6 +6,8 @@ import com.pengrad.telegrambot.model.CallbackQuery; import com.pengrad.telegrambot.model.Update; import com.pengrad.telegrambot.request.SendMessage; import com.pengrad.telegrambot.request.SendPhoto; +import com.pengrad.telegrambot.request.SendVideo; +import com.pengrad.telegrambot.response.SendResponse; import java.io.FileInputStream; import java.io.IOException; @@ -35,15 +37,15 @@ public class Bot { }); } - public static void showAnimeAtMainMenu(TelegramBot telegramBot, Update update, byte index, String url, String typeOfAnime) throws IOException { - Anime[] anime = new Anime[Parser.getAnimeAtSearchSize(url)]; + public static void showAnimeAtMainMenu(TelegramBot telegramBot, Update update, byte index, String url, String typeOfAnime) { + Anime[] anime = new Anime[28]; try { anime = Parser.getAnimeAtMainMenu(url); } catch (IOException e) { e.printStackTrace(); } Anime.setList(anime); - telegramBot.execute(new SendPhoto(update.message().chat().id(), anime[index].getImage()).caption(anime[index].showInfo()).replyMarkup(MyKeyboard.getCarousel(typeOfAnime))); + telegramBot.execute(new SendPhoto(UserMessage.chatId, anime[index].getImage()).caption(anime[index].showInfo()).replyMarkup(MyKeyboard.getCarousel(typeOfAnime))); } public static void showAnimeAtMainMenuByCallBackQuery(TelegramBot telegramBot, CallbackQuery callbackQuery, byte index, String typeOfAnime, Anime[] list) { @@ -73,7 +75,7 @@ public class Bot { } public static void showRecentlyAddedAnime(TelegramBot telegramBot, Update update, byte index) throws IOException { - showAnimeAtMainMenu(telegramBot, update, index, "https://animego.org/anime?sort=a.createdAt&direction=desc", "RecentlyAddedAnime"); + showAnimeAtMainMenu(telegramBot, update, index, "https://anime.anidub.life/anime/anime_ongoing/", "RecentlyAddedAnime"); } public static void showRecentlyAddedAnimeByCallBackQuery(TelegramBot telegramBot, CallbackQuery callbackQuery, byte index) { -- cgit v1.2.3