Esempio n. 1
0
        public async Task <string> GetArenaViewAsync(DuelInfo info, ITextChannel trashChannel)
        {
            string url            = null;
            string imageUrlWinner = await GetCardUrlIfExistAsync(info.Winner, force : true);

            string imageUrlLooser = await GetCardUrlIfExistAsync(info.Loser, force : true);

            DuelImage dImg   = null;
            var       reader = new Config.JsonFileReader($"./Pictures/Duel/List.json");

            try
            {
                var images = reader.Load <List <DuelImage> >();
                dImg = Fun.GetOneRandomFrom(images);
            }
            catch (Exception) { }

            using (var winner = await _img.GetWaifuCardAsync(imageUrlWinner, info.Winner))
            {
                using (var looser = await _img.GetWaifuCardAsync(imageUrlLooser, info.Loser))
                {
                    using (var img = _img.GetDuelCardImage(info, dImg, winner, looser))
                    {
                        using (var stream = img.ToPngStream())
                        {
                            var msg = await trashChannel.SendFileAsync(stream, $"duel.png");

                            url = msg.Attachments.First().Url;
                        }
                    }
                }
            }

            return(url);
        }
Esempio n. 2
0
        public SafariImage GetRandomSarafiImage()
        {
            SafariImage dImg   = null;
            var         reader = new Config.JsonFileReader($"./Pictures/Poke/List.json");

            try
            {
                var images = reader.Load <List <SafariImage> >();
                dImg = Fun.GetOneRandomFrom(images);
            }
            catch (Exception) { }

            return(dImg);
        }