示例#1
0
        protected override async Task VerifyResponseToSendMessage()
        {
            int counterForNumberOfItemsInAList = 0;

            if (RecommendationList == null || RecommendationList.Recommendations.Count == 0)
            {
                await ReplyAsync("The anime was found but there are no recommendations like it.");

                return;
            }

            while (EmbedMessage.Fields.Count < LIMIT_OF_FIELDS_PER_EMBED_MESSAGE &&
                   EmbedMessage.Fields.Count < RecommendationList.Recommendations.Count)
            {
                EmbedMessage.AddField(x =>
                {
                    x.Name     = RecommendationList.Recommendations[counterForNumberOfItemsInAList].Title;
                    x.Value    = RecommendationList.Recommendations[counterForNumberOfItemsInAList].URL;
                    x.IsInline = false;
                });

                ++counterForNumberOfItemsInAList;
            }

            await ReplyAsync("", false, EmbedMessage.Build());
        }
        protected override async Task VerifyResponseToSendMessage()
        {
            if (MangaSearch == null || MangaSearch.Results.Count == 0)
            {
                await ReplyAsync("I didn't find any mangas. That's weird. :thinking:");

                return;
            }

            PopulateEmbedMessageFieldsWithHighestScoreMangas();

            await ReplyAsync("", false, EmbedMessage.Build());
        }
        private void PopulateEmbedMessageFieldsWithHighestScoreMangas()
        {
            int counterForCurrentFieldInTheEmbedMessage = 0;

            while (EmbedMessage.Fields.Count < LIMIT_OF_FIELDS_PER_EMBED_MESSAGE)
            {
                EmbedMessage.AddField(x =>
                {
                    x.Name     = $"{MangaSearch.Results[counterForCurrentFieldInTheEmbedMessage].Title ?? MangaSearch.Results[counterForCurrentFieldInTheEmbedMessage].Name}";
                    x.Value    = $"Link: {MangaSearch.Results[counterForCurrentFieldInTheEmbedMessage].URL}\nScore: {MangaSearch.Results[counterForCurrentFieldInTheEmbedMessage].Score}";
                    x.IsInline = false;
                });

                ++counterForCurrentFieldInTheEmbedMessage;
            }
        }
示例#4
0
        public Task BuildEmbedMessageWithAnimeScheduledForSaturday()
        {
            Parallel.ForEach(Animes.Saturday, anime =>
            {
                if (EmbedMessage.Fields.Count < LIMIT_OF_FIELDS_PER_EMBED_MESSAGE)
                {
                    EmbedMessage.AddField(x =>
                    {
                        x.Name     = $"{anime.Title ?? anime.Name}";
                        x.Value    = $"More Info: {anime.URL}\nEpisodes: {anime.Episodes}\nScore: {anime.Score}";
                        x.IsInline = false;
                    });
                }
            });

            return(Task.CompletedTask);
        }
        public async Task GetBurinbotServers()
        {
            try
            {
                foreach (var server in Context.Client.CurrentUser.MutualGuilds)
                {
                    Description.AppendLine($"{server.Name}");
                }

                CreateDiscordEmbedMessage(
                    $"Burinbot is currently in {Context.Client.CurrentUser.MutualGuilds.Count} servers!",
                    Color.Green,
                    Description.ToString());

                await ReplyAsync("", false, EmbedMessage.Build());
            }
            catch (Exception ex)
            {
                await SendExceptionMessageInDiscordChat(ex);
            }
        }
示例#6
0
        protected override async Task VerifyResponseToSendMessage()
        {
            int countNumberOfAddedAnimes = 0;

            if (TopAnimes == null || TopAnimes.Top.Count == 0)
            {
                throw new ArgumentNullException("Nothing was found inside the TopAnimes list.");
            }

            while (EmbedMessage.Fields.Count < LIMIT_OF_FIELDS_PER_EMBED_MESSAGE)
            {
                EmbedMessage.AddField(x =>
                {
                    x.Name = TopAnimes.Top[countNumberOfAddedAnimes].Title
                             ?? TopAnimes.Top[countNumberOfAddedAnimes].Name;
                    x.Value    = $"Rank: {TopAnimes.Top[countNumberOfAddedAnimes].Rank}";
                    x.IsInline = false;
                });

                ++countNumberOfAddedAnimes;
            }

            await ReplyAsync("", false, EmbedMessage.Build());
        }
示例#7
0
 protected override async Task VerifyResponseToSendMessage() => await ReplyAsync("", false, EmbedMessage.Build());