Simple weather plugin for UniBot. This uses OpenWeatherMap API to fetch actual weather information.
To your UniBot application
npm install git://github.com/UniBot/unibot-weather --save
And after that register new plugin on IRC channels what you need
plugin [#channel] weather
ps. remember to restart your UnitBot.
You can configure this plugin adding weather
section to your UniBot config.js
file. Example below with
default values.
module.exports = {
...
plugins: {
"weather": {
"commands": [
"weather"
],
"location": "Jyväskylä",
"showFetchMessage": true,
"units": "metric",
"messages": {
"fetch": "${nick} wait a moment fetching weather data for '${location}'...",
"success": "${nick}: temperature: ${weather.main.temp}°C (min: ${weather.main.temp_min}°C, max: ${weather.main.temp_max}°C), wind speed: ${weather.wind.speed}m/s, ${weather.weather[0].main}: ${weather.weather[0].description}",
"error": "${nick} cannot find any weather data for '${location}'..."
}
}
}
};
Array of actual trigger commands. By default only weather
is set. These are added to actual regex command that
plugin will watch on specified IRC channel.
Default location to use if command is triggered without location.
Show fetch message on channel or not.
What units OpenWeatherMap will use. Following values are allowed:
internal
http://api.openweathermap.org/data/2.5/find?q=Londonmetric
http://api.openweathermap.org/data/2.5/find?q=London&units=metricimperial
http://api.openweathermap.org/data/2.5/find?q=London&units=imperial
Message that is shown on channel when plugin starts to fetch weather data. Note that this can be disabled. Following template variables are available with this message.
nick
location
Message that is shown on channel after successfully weather data fetch. Following template variables are available with this message.
nick
location
weather.*
Where weather contains all the data from OpenWeatherMap API, you can see an example result with following URL
http://api.openweathermap.org/data/2.5/find?units=metric&q=Jyv%C3%A4skyl%C3%A4 note that plugin will iterate each items
from list
key and sends messages from each to specified channel.
Message that is shown on channel if plugin cannot find any weather data for specified location. Following template variables are available with this message.
nick
location
After installation just type !weather [location]
on the IRC channel.