mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
✏️ print kanban on start
This commit is contained in:
parent
6e0222f5e2
commit
2a5c1ac92c
28
main.go
28
main.go
@ -113,10 +113,25 @@ func printBanner() {
|
|||||||
fmt.Print(
|
fmt.Print(
|
||||||
"\n======================[ZeroBot-Plugin]======================",
|
"\n======================[ZeroBot-Plugin]======================",
|
||||||
"\n", banner, "\n",
|
"\n", banner, "\n",
|
||||||
|
"----------------------[ZeroBot-公告栏]----------------------",
|
||||||
|
"\n", getKanban(), "\n",
|
||||||
"============================================================\n",
|
"============================================================\n",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getKanban() string {
|
||||||
|
err := reg.Connect()
|
||||||
|
defer reg.Close()
|
||||||
|
if err != nil {
|
||||||
|
return err.Error()
|
||||||
|
}
|
||||||
|
text, err := reg.Get("ZeroBot-Plugin/kanban")
|
||||||
|
if err != nil {
|
||||||
|
return err.Error()
|
||||||
|
}
|
||||||
|
return text
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
printBanner()
|
printBanner()
|
||||||
// 帮助
|
// 帮助
|
||||||
@ -126,18 +141,7 @@ func main() {
|
|||||||
})
|
})
|
||||||
zero.OnFullMatch("查看zbp公告", zero.OnlyToMe, zero.AdminPermission).SetBlock(true).FirstPriority().
|
zero.OnFullMatch("查看zbp公告", zero.OnlyToMe, zero.AdminPermission).SetBlock(true).FirstPriority().
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
err := reg.Connect()
|
ctx.SendChain(message.Text(getKanban()))
|
||||||
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{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user