Weather API pozwala na pobieranie aktualnych danych pogodowych dla dowolnej lokalizacji. API korzysta z serwisu WeatherAPI.com, aby dostarczyć precyzyjne informacje o temperaturze, wietrze, wilgotności i innych parametrach pogodowych.
https://www.bdfdhub.pl/api/weather/api.php?locate=NAZWA_MIASTA
API zwraca dane w formacie JSON z następującymi polami:
{
"bh.weatherCity": "",
"bh.weatherRegion": "",
"bh.weatherCountry": "",
"bh.weatherTemperature": "",
"bh.weatherFeelsLike": "",
"bh.weatherPressure": "",
"bh.weatherHumidity": "",
"bh.weatherWindSpeed": "",
"bh.weatherWindDirection": "",
"bh.weatherPrecipitation": "",
"bh.weatherVisibility": "",
"bh.weatherUV": "",
"bh.weatherWeather": "",
"bh.weatherIcon": "",
"bh.weatherSource": ""
}
Weather API może być używane w botach Discord do różnych celów, takich jak:
$httpGet[https://www.bdfdhub.pl/api/weather/api.php?locate=$message[1]]
$httpGet[https://www.bdfdhub.pl/api/weather/api.php?locate=$message[1]]
$title[Pogoda dla $httpResult[bh.weatherCity], $httpResult[bh.weatherCountry]]
$description[
🌡 Temperatura: $httpResult[bh.weatherTemperature]
🌬 Wiatr: $httpResult[bh.weatherWindSpeed] ($httpResult[bh.weatherWindDirection])
💧 Wilgotność: $httpResult[bh.weatherHumidity]
🌤 Pogoda: $httpResult[bh.weatherWeather]
]
$image[$httpResult[bh.weatherIcon]]
$footer[Źródło: $httpResult[bh.weatherSource]]
Po wykonaniu komendy bot wyświetli aktualne informacje pogodowe dla podanej lokalizacji.