weather

package
v0.0.0-...-0d01ef4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2015 License: BSD-1-Clause Imports: 10 Imported by: 0

README

Weather

This plugin provides weather report services using the worldweatheronline API.

It requires registration of a free account to obtain an API key. This key should be entered in the plugin configuration file.

[api]
key = xxxxxxxxxxxxxxxxx

It presents weather data in the following form:

<bob> ?weather london
<bot> bob, weather in London, United Kingdom: 3°C/37°F/276.15°K, Partly, 
      cloud cover: 50%, humidity: 56%, wind: 20kph/13mph from E, pressure: 
      1012 mb, visibility: 10 km

Commands

  • weather <location>: Fetches current weather data for the given location. The location can be a city or town name or a postal code.

Documentation

Overview

This plugin provides weather report services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(profile string) plugin.Plugin

Types

type Plugin

type Plugin struct {
	*plugin.Base
}

func (*Plugin) Load

func (p *Plugin) Load(c *proto.Client) (err error)

type WeatherData

type WeatherData struct {
	Data struct {
		Conditions []struct {
			CloudCover      string `json:"cloudcover"`
			Humidity        string `json:"humidity"`
			ObservationTime string `json:"observation_time"`
			Precip          string `json:"precipMM"`
			Pressure        string `json:"pressure"`
			TempC           string `json:"temp_C"`
			TempF           string `json:"temp_F"`
			Visibility      string `json:"visibility"`
			WeatherCode     string `json:"weatherCode"`
			WeatherDesc     []struct {
				Value string `json:"value"`
			} `json:"weatherDesc"`
			WeatherIconUrl []struct {
				Value string `json:"value"`
			} `json:"weatherIconUrl"`
			WindDir16Point string `json: "winddir16Point"`
			WindDirDegree  string `json: "winddirDegree"`
			WindSpeedKmph  string `json: "windspeedKmph"`
			WindSpeedMiles string `json: "windspeedMiles"`
		} `json:"current_condition"`
		Request []struct {
			Query string
			Type  string
		} `json:"request"`
	} `json:"data"`
}

func (*WeatherData) TempK

func (w *WeatherData) TempK() float32

TempK returns the temerature in degrees Kelvin.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL