-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature zbpp bilibilipush 20230224 (#599)
* 🔥 删除小鸡词典 * ✨ 添加新插件和修改bilibilipush问题 * 🎨 去掉多余结构 * 🎨 简化语句
- Loading branch information
1 parent
bdc4138
commit 091d317
Showing
8 changed files
with
515 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Package dailynews 今日早报 | ||
package dailynews | ||
|
||
import ( | ||
"github.com/FloatTech/floatbox/binary" | ||
"github.com/FloatTech/floatbox/web" | ||
ctrl "github.com/FloatTech/zbpctrl" | ||
"github.com/FloatTech/zbputils/control" | ||
"github.com/tidwall/gjson" | ||
zero "github.com/wdvxdr1123/ZeroBot" | ||
"github.com/wdvxdr1123/ZeroBot/message" | ||
) | ||
|
||
const api = "http://dwz.2xb.cn/zaob" | ||
|
||
func init() { | ||
engine := control.Register("dailynews", &ctrl.Options[*zero.Ctx]{ | ||
DisableOnDefault: false, | ||
Brief: "今日早报", | ||
Help: "- 今日早报", | ||
PrivateDataFolder: "dailynews", | ||
}) | ||
|
||
engine.OnFullMatch(`今日早报`).SetBlock(true). | ||
Handle(func(ctx *zero.Ctx) { | ||
data, err := web.GetData(api) | ||
if err != nil { | ||
return | ||
} | ||
picURL := gjson.Get(binary.BytesToString(data), "imageUrl").String() | ||
if err != nil { | ||
ctx.SendChain(message.Text("ERROR:", err)) | ||
return | ||
} | ||
ctx.SendChain(message.Image(picURL)) | ||
}) | ||
} |
Oops, something went wrong.