Пример #1
0
        public async Task GetWeather([Remainder] string location)
        {
            try
            {
                var locationData = await _mapbox.GetLocationData(location);

                var report = await _weather.GenerateWeatherReport(locationData.Latitude, locationData.Longitude);

                var image = await _mapbox.GetMapImage(locationData.Latitude, locationData.Longitude);

                Stream stream = new MemoryStream(image);

                var embed = new EmbedBuilder
                {
                    ImageUrl = "attachment://image.png"
                };
                embed.AddField(locationData.Address, report.Current);
                embed.AddField("Najbliższe dni", report.Daily);

                await Context.Channel.SendFileAsync(stream, "image.png", embed : embed.Build());
            }
            catch (ArgumentException ex)
            {
                await ReplyAsync(ex.Message);
            }
        }