29 lines
596 B
Go
29 lines
596 B
Go
package controller
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/eatmoreapple/openwechat"
|
|
"github.com/kirinlabs/HttpRequest"
|
|
)
|
|
|
|
type name struct {
|
|
weatherAPI string "https://dashboard.caiyunapp.com/"
|
|
}
|
|
|
|
func GetWeather(msg *openwechat.Message, self *openwechat.Self) {
|
|
get, err := HttpRequest.JSON().Get("https://api.caiyunapp.com/v2.6/y1BgC9gnutIzXlZF/126.62,45.62/realtime?alert=true")
|
|
if err != nil {
|
|
|
|
}
|
|
body, err := get.Body()
|
|
if err != nil {
|
|
|
|
}
|
|
|
|
groups, err := self.Groups()
|
|
name := groups.GetByNickName("叫啥好呢")
|
|
fmt.Printf(name.NickName, err)
|
|
|
|
self.SendTextToGroup(name, string(body))
|
|
}
|