| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package cmd |
||
| 2 | |||
| 3 | import ( |
||
| 4 | "github.com/FlameInTheDark/dtbot/api/darksky" |
||
| 5 | "github.com/FlameInTheDark/dtbot/bot" |
||
| 6 | ) |
||
| 7 | |||
| 8 | // WeatherCommand weather handler |
||
| 9 | func WeatherCommand(ctx bot.Context) { |
||
| 10 | ctx.MetricsCommand("weather", "main") |
||
| 11 | buf, err := darksky.GetWeatherImage(&ctx) |
||
| 12 | if err != nil { |
||
| 13 | ctx.Log("Weather", ctx.Guild.ID, err.Error()) |
||
| 14 | return |
||
| 15 | } |
||
| 16 | ctx.ReplyFile("weather.png", buf) |
||
| 17 | } |
||
| 18 | |||
| 19 | // WeatherCommand weather handler |
||
|
|
|||
| 20 | func WeatherWeekCommand(ctx bot.Context) { |
||
| 21 | ctx.MetricsCommand("weather", "week") |
||
| 22 | buf, err := darksky.GetWeatherImage(&ctx) |
||
| 23 | if err != nil { |
||
| 24 | ctx.Log("Weather", ctx.Guild.ID, err.Error()) |
||
| 25 | return |
||
| 26 | } |
||
| 27 | ctx.ReplyFile("weather.png", buf) |
||
| 28 | } |