Exemple #1
0
        public async Task GetRecommendations(int minimalScore)
        {
            await ReplyAsync("Starting collecting data, it's a long process");

            var animeList = await AnimeUtills.GetAnime();

            var allRecs = new List <string>();

            foreach (var anime in animeList)
            {
                if (anime.Score >= minimalScore)
                {
                    allRecs.AddRange(await anime.GetRecomendations());
                    Logger.Info($"{anime.Name} is processed, size: {allRecs.Count}");
                    await Task.Delay(2 * 1000);
                }
            }

            var dictRecs = allRecs.GroupBy(q => q).ToDictionary(x => x.Key, x => x.Count());

            var orderedDictRecs = from entry in dictRecs orderby entry.Value descending select entry;

            foreach (var item in orderedDictRecs)
            {
                System.Console.WriteLine(item.Key + " " + item.Value);
            }

            await ReplyAsync("Your recommendations");

            var i = 0;

            foreach (var item in orderedDictRecs)
            {
                var found = false;
                foreach (var anime in animeList)
                {
                    if (item.Equals(anime.Name))
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    await ReplyAsync(item.Key);

                    i++;
                }

                if (i >= 3)
                {
                    break;
                }
            }

            await ReplyAsync("Done!");
        }
Exemple #2
0
        private static async Task <List <AnimeInfo> > GetAnimeData()
        {
            var animeData = await AnimeUtills.GetAnime();

            while (animeData == null)
            {
                await Task.Delay(30 * 1000);

                animeData = await AnimeUtills.GetAnime();
            }

            return(animeData);
        }
Exemple #3
0
        public async Task GetAnimeCommand()
        {
            await ReplyAsync("Starting collecting data");

            var animeList = await AnimeUtills.GetAnime();

            foreach (var anime in animeList)
            {
                if (anime.WatchingStatus == 1)
                {
                    await ReplyAsync(anime.GetFullInfo());
                }
            }
        }