Added country to invalid city ID search.

This commit is contained in:
Erik C. Thauvin 2019-07-28 23:13:47 -07:00
parent 351f117d38
commit 34c7adddff
2 changed files with 3 additions and 3 deletions

View file

@ -169,14 +169,14 @@ public class Weather2 extends ThreadedModule {
}
}
if (cwd.getCityId() != null) {
if (cwd.hasCityId() && cwd.getCityId() != null) {
if (cwd.getCityId() > 0) {
messages.add(new NoticeMessage("https://openweathermap.org/city/" + cwd.getCityId(),
Colors.GREEN));
} else {
final HttpUrl url =
HttpUrl.parse("https://openweathermap.org/find").newBuilder().addQueryParameter(
"q", city).build();
"q", city + ',' + country).build();
messages.add(
new NoticeMessage(url.toString(), Colors.GREEN));
}