mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 13:59:39 +08:00
Update dailynews.go
This commit is contained in:
parent
57c95178d8
commit
6137a371d2
@ -2,19 +2,19 @@
|
|||||||
package dailynews
|
package dailynews
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/FloatTech/floatbox/binary"
|
"encoding/base64"
|
||||||
|
|
||||||
"github.com/FloatTech/floatbox/web"
|
"github.com/FloatTech/floatbox/web"
|
||||||
ctrl "github.com/FloatTech/zbpctrl"
|
ctrl "github.com/FloatTech/zbpctrl"
|
||||||
"github.com/FloatTech/zbputils/control"
|
"github.com/FloatTech/zbputils/control"
|
||||||
"github.com/tidwall/gjson"
|
|
||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
"github.com/wdvxdr1123/ZeroBot/message"
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
)
|
)
|
||||||
|
|
||||||
const api = "http://dwz.2xb.cn/zaob"
|
const api = "https://uapis.cn/api/v1/daily/news-image"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
engine := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
|
engine := control.Register("dailynews", &ctrl.Options[*zero.Ctx]{
|
||||||
DisableOnDefault: false,
|
DisableOnDefault: false,
|
||||||
Brief: "今日早报",
|
Brief: "今日早报",
|
||||||
Help: "- 今日早报",
|
Help: "- 今日早报",
|
||||||
@ -28,7 +28,6 @@ func init() {
|
|||||||
ctx.SendChain(message.Text("ERROR: ", err))
|
ctx.SendChain(message.Text("ERROR: ", err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
picURL := gjson.Get(binary.BytesToString(data), "imageUrl").String()
|
ctx.SendChain(message.Image("base64://" + base64.StdEncoding.EncodeToString(data)))
|
||||||
ctx.SendChain(message.Image(picURL))
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user