refactor api call

This commit is contained in:
lyx0 2021-10-17 17:33:46 +02:00
parent 9e16da650f
commit 4c79f6527a
2 changed files with 6 additions and 3 deletions

View file

@ -8,8 +8,8 @@ import (
log "github.com/sirupsen/logrus"
)
func Weather(location string) string {
resp, err := http.Get(fmt.Sprintf("https://customapi.aidenwallis.co.uk/api/v1/misc/weather/%s", location))
func Weather(uri string) string {
resp, err := http.Get(fmt.Sprintf("https://customapi.aidenwallis.co.uk/%s", uri))
if err != nil {
log.Error(err)
return "Something went wrong FeelsBadMan"

View file

@ -1,12 +1,15 @@
package commands
import (
"fmt"
"github.com/gempir/go-twitch-irc/v2"
"github.com/lyx0/nourybot/pkg/api/aiden"
)
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)
}