✏️ 添加公告看板

This commit is contained in:
fumiama 2021-12-14 13:33:28 +08:00
parent 218119e10e
commit 33b85207f5
2 changed files with 19 additions and 2 deletions

View File

@ -294,7 +294,7 @@ func init() {
zero.OnCommandGroup([]string{"服务列表", "service_list"}, userOrGrpAdmin). zero.OnCommandGroup([]string{"服务列表", "service_list"}, userOrGrpAdmin).
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
msg := `---服务列表---` msg := "--------服务列表--------\n发送\"/用法 name\"查看详情"
i := 0 i := 0
gid := ctx.Event.GroupID gid := ctx.Event.GroupID
ForEach(func(key string, manager *Control) bool { ForEach(func(key string, manager *Control) bool {

19
main.go
View File

@ -16,6 +16,7 @@ import (
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_atri" // ATRI词库 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_atri" // ATRI词库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_chat" // 基础词库 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_chat" // 基础词库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_qingyunke" // 青云客 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_qingyunke" // 青云客
"github.com/fumiama/go-registry"
// 实用类 // 实用类
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_b14" // base16384加解密 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_b14" // base16384加解密
@ -74,6 +75,7 @@ var (
banner = strings.Join(contents, "\n") banner = strings.Join(contents, "\n")
token *string token *string
url *string url *string
reg = registry.NewRegReader("reilia.eastasia.azurecontainer.io:32664", "fumiama")
) )
func init() { func init() {
@ -120,7 +122,22 @@ func main() {
// 帮助 // 帮助
zero.OnFullMatchGroup([]string{"/help", ".help", "菜单"}, zero.OnlyToMe).SetBlock(true).FirstPriority(). zero.OnFullMatchGroup([]string{"/help", ".help", "菜单"}, zero.OnlyToMe).SetBlock(true).FirstPriority().
Handle(func(ctx *zero.Ctx) { Handle(func(ctx *zero.Ctx) {
ctx.SendChain(message.Text(banner, "\n可发送\"/服务详情\"查看 bot 功能")) ctx.SendChain(message.Text(banner, "\n可发送\"/服务列表\"查看 bot 功能"))
})
zero.OnFullMatch("查看zbp公告", zero.OnlyToMe, zero.AdminPermission).SetBlock(true).FirstPriority().
Handle(func(ctx *zero.Ctx) {
err := reg.Connect()
defer reg.Close()
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
text, err := reg.Get("ZeroBot-Plugin/kanban")
if err != nil {
ctx.SendChain(message.Text("ERROR:", err))
return
}
ctx.SendChain(message.Text(text))
}) })
zero.RunAndBlock( zero.RunAndBlock(
zero.Config{ zero.Config{