<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Telegram.Bot;
using Telegram.Bot.Types;

namespace DwellerBot.Commands
{
    class WeatherCommand : ICommand
    {
        private const string WeatherQueryUrl =
            @"http://api.openweathermap.org/data/2.5/weather?q=Minsk,by&units=metric&lang=ru&APPID=";

        private readonly string _apiKey;
        private readonly Api _bot;

        public WeatherCommand(Api bot, string apiKey)
        {
            _bot = bot;
            _apiKey = apiKey;
        }

        public void Execute(Update update)
        {
            throw new NotImplementedException();
        }

        public async Task ExecuteAsync(Update update, Dictionary<string, string> parsedMessage)
        {
            var responseStream = new StreamReader(await GetWeather());
            var weatherContainer = JsonConvert.DeserializeObject<WeatherContainer>(responseStream.ReadToEnd());
            var sb = new StringBuilder();
            sb.Append("Погода в " + weatherContainer.name + ", " + weatherContainer.sys.country);
            sb.AppendLine(" на " + UnixTimeStampToDateTime(weatherContainer.dt).ToLocalTime().ToShortDateString());
            sb.AppendLine();
            sb.AppendLine("От " + weatherContainer.main.temp_min +
                          " до " + weatherContainer.main.temp_max + " *С, " +
                          weatherContainer.weather[0].description);<commit_msg>Changed temp from range to one value<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Telegram.Bot;
using Telegram.Bot.Types;

namespace DwellerBot.Commands
{
    class WeatherCommand : ICommand
    {
        private const string WeatherQueryUrl =
            @"http://api.openweathermap.org/data/2.5/weather?q=Minsk,by&units=metric&lang=ru&APPID=";

        private readonly string _apiKey;
        private readonly Api _bot;

        public WeatherCommand(Api bot, string apiKey)
        {
            _bot = bot;
            _apiKey = apiKey;
        }

        public void Execute(Update update)
        {
            throw new NotImplementedException();
        }

        public async Task ExecuteAsync(Update update, Dictionary<string, string> parsedMessage)
        {
            var responseStream = new StreamReader(await GetWeather());
            var weatherContainer = JsonConvert.DeserializeObject<WeatherContainer>(responseStream.ReadToEnd());
            var sb = new StringBuilder();
            sb.Append("Погода в " + weatherContainer.name + ", " + weatherContainer.sys.country);
            sb.AppendLine(" на " + UnixTimeStampToDateTime(weatherContainer.dt).ToLocalTime().ToShortDateString());
            sb.AppendLine();
            /*sb.AppendLine("От " + weatherContainer.main.temp_min +
                          " до " + weatherContainer.main.temp_max + " *С, " +
                          weatherContainer.weather[0].description);*/
            sb.AppendLine("Температура: " + weatherContainer.main.temp + " *C, " + weatherContainer.weather[0].description);
{'fraction_non_alphanumeric': 0.10307414104882459, 'fraction_numerical': 0.002109704641350211, 'mean_word_length': 2.591991341991342, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5984840', 'n_tokens_mistral': 906, 'n_tokens_neox': 891, 'n_words': 185}