Skip to content

Alcheri/Weather

Weather

Tests Lint CodeQL Python Black Limnoria

A fully asynchronous Limnoria plugin that uses the Google Maps Geocoding API to resolve locations and the OpenWeather One Call 3.0 API to report current conditions and forecasts.

All output is in metric units.

Requirements

  • Python 3.10 or newer
  • aiohttp
  • A Google Maps Geocoding API key
  • An OpenWeather One Call 3.0 API key

Install the plugin dependency from the plugin directory:

python -m pip install --upgrade -r requirements.txt

Installation

Clone the plugin into your Limnoria plugins directory, then load it in Limnoria:

/msg bot load Weather

Configuration

Set the required API keys:

/msg bot config plugins.Weather.googlemapsAPI <google-maps-api-key>
/msg bot config plugins.Weather.openweatherAPI <openweather-api-key>

Enable the plugin per channel:

/msg bot config channel #channel plugins.Weather.enabled True

If the channel-scoped enabled value is False, the weather and google commands do not reply in that channel.

Optional API lookup cooldown:

/msg bot config channel #channel plugins.Weather.cooldownSeconds 10

Commands

weather [--user <nick>] [--forecast] [-- <location>]

Shows current weather for a supplied location. If <location> is omitted, the plugin looks up a saved location for the caller's ident@host. With --user <nick>, it looks up the saved location for that nick's hostmask.

Use --forecast to return a five-day forecast instead of current conditions.

Examples:

@weather Ballarat VIC AU
@weather --forecast Ballarat VIC AU
@weather --user SomeNick
@weather -- -37.5621587 143.8502556

The -- separator is important when the location starts with a minus sign, such as southern latitudes.

set <location>

Stores a default location for your current ident@host.

Example:

@set Ballarat VIC AU

unset

Removes the saved default location for your current ident@host.

Example:

@unset

google <location>

Resolves a location through Google Maps and returns the formatted address, postcode when available, Google place ID, latitude, and longitude.

Examples:

@google Ballarat VIC AU
@google -37.5283674, 143.8164991

Notes

  • Country codes should use ISO 3166-1 alpha-2 codes where applicable.
  • Saved locations are stored per ident@host.
  • Saved locations are normalised and capped at 160 characters.
  • API-backed commands use the channel-scoped cooldown to protect API quota.
  • The plugin keeps its own async event loop and HTTP session so Limnoria commands can remain synchronous from the user's point of view.

Development

From the plugin directory:

python -m ruff check .
python -m black --check .
python -m pytest

About

Get the current weather for the specified location, or a default location.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Contributors

Languages