mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
refactor api call
This commit is contained in:
parent
9e16da650f
commit
4c79f6527a
|
@ -8,8 +8,8 @@ import (
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Weather(location string) string {
|
func Weather(uri string) string {
|
||||||
resp, err := http.Get(fmt.Sprintf("https://customapi.aidenwallis.co.uk/api/v1/misc/weather/%s", location))
|
resp, err := http.Get(fmt.Sprintf("https://customapi.aidenwallis.co.uk/%s", uri))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return "Something went wrong FeelsBadMan"
|
return "Something went wrong FeelsBadMan"
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
package commands
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/gempir/go-twitch-irc/v2"
|
"github.com/gempir/go-twitch-irc/v2"
|
||||||
"github.com/lyx0/nourybot/pkg/api/aiden"
|
"github.com/lyx0/nourybot/pkg/api/aiden"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Weather(channel string, location string, client *twitch.Client) {
|
func Weather(channel string, location string, client *twitch.Client) {
|
||||||
reply := aiden.Weather(location)
|
|
||||||
|
reply := aiden.Weather(fmt.Sprintf("api/v1/misc/weather/%s", location))
|
||||||
client.Say(channel, reply)
|
client.Say(channel, reply)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue