mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 05:30:07 +08:00
优化 banner
This commit is contained in:
parent
0e52bbe0f7
commit
1c274d6eb8
@ -1,2 +1,12 @@
|
|||||||
// Package console sets console's behavior on init
|
// Package console sets console's behavior on init
|
||||||
package console
|
package console
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/FloatTech/ZeroBot-Plugin/kanban/banner"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
fmt.Print("\033]0;ZeroBot-Blugin " + banner.Version + " " + banner.Copyright + "\007")
|
||||||
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/FloatTech/ZeroBot-Plugin/kanban"
|
"github.com/FloatTech/ZeroBot-Plugin/kanban/banner"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -78,7 +78,7 @@ func init() {
|
|||||||
// windows 带颜色 log 自定义格式
|
// windows 带颜色 log 自定义格式
|
||||||
logrus.SetFormatter(&LogFormat{})
|
logrus.SetFormatter(&LogFormat{})
|
||||||
|
|
||||||
err = setConsoleTitle("ZeroBot-Blugin " + kanban.Version + " " + kanban.Copyright)
|
err = setConsoleTitle("ZeroBot-Blugin " + banner.Version + " " + banner.Copyright)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
// Code generated by kanban/gen. DO NOT EDIT.
|
// Code generated by kanban/gen. DO NOT EDIT.
|
||||||
|
|
||||||
package kanban
|
package banner
|
||||||
|
|
||||||
// Version ...
|
// Version ...
|
||||||
var Version = "v1.7.0-beta1"
|
var Version = "v1.6.2"
|
||||||
|
|
||||||
// Copyright ...
|
// Copyright ...
|
||||||
var Copyright = "© 2020 - 2023 FloatTech"
|
var Copyright = "© 2020 - 2023 FloatTech"
|
||||||
|
|
||||||
// Banner ...
|
// Banner ...
|
||||||
var Banner = "* OneBot + ZeroBot + Golang\n" +
|
var Banner = "* OneBot + ZeroBot + Golang\n" +
|
||||||
"* Version " + Version + " - 2023-03-01 11:21:16 +0800 CST\n" +
|
"* Version " + Version + " - 2023-03-01 12:17:07 +0800 CST\n" +
|
||||||
"* Copyright " + Copyright + ". All Rights Reserved.\n" +
|
"* Copyright " + Copyright + ". All Rights Reserved.\n" +
|
||||||
"* Project: https://github.com/FloatTech/ZeroBot-Plugin"
|
"* Project: https://github.com/FloatTech/ZeroBot-Plugin"
|
||||||
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
const banner = `// Code generated by kanban/gen. DO NOT EDIT.
|
const banner = `// Code generated by kanban/gen. DO NOT EDIT.
|
||||||
|
|
||||||
package kanban
|
package banner
|
||||||
|
|
||||||
// Version ...
|
// Version ...
|
||||||
var Version = "%s"
|
var Version = "%s"
|
||||||
@ -30,7 +30,7 @@ var Banner = "* OneBot + ZeroBot + Golang\n" +
|
|||||||
const timeformat = `2006-01-02 15:04:05 +0800 CST`
|
const timeformat = `2006-01-02 15:04:05 +0800 CST`
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
f, err := os.Create("banner.go")
|
f, err := os.Create("banner/banner.go")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/FloatTech/zbputils/control"
|
"github.com/FloatTech/zbputils/control"
|
||||||
"github.com/fumiama/go-registry"
|
"github.com/fumiama/go-registry"
|
||||||
|
|
||||||
|
"github.com/FloatTech/ZeroBot-Plugin/kanban/banner"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate go run github.com/FloatTech/ZeroBot-Plugin/kanban/gen
|
//go:generate go run github.com/FloatTech/ZeroBot-Plugin/kanban/gen
|
||||||
@ -23,7 +25,7 @@ var reg = registry.NewRegReader("reilia.fumiama.top:32664", control.Md5File, "fu
|
|||||||
func PrintBanner() {
|
func PrintBanner() {
|
||||||
fmt.Print(
|
fmt.Print(
|
||||||
"\n======================[ZeroBot-Plugin]======================",
|
"\n======================[ZeroBot-Plugin]======================",
|
||||||
"\n", Banner, "\n",
|
"\n", banner.Banner, "\n",
|
||||||
"----------------------[ZeroBot-公告栏]----------------------",
|
"----------------------[ZeroBot-公告栏]----------------------",
|
||||||
"\n", Kanban(), "\n",
|
"\n", Kanban(), "\n",
|
||||||
"============================================================\n\n",
|
"============================================================\n\n",
|
||||||
|
|||||||
10
main.go
10
main.go
@ -12,10 +12,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/FloatTech/ZeroBot-Plugin/kanban" // 在最前打印 banner
|
|
||||||
|
|
||||||
_ "github.com/FloatTech/ZeroBot-Plugin/console" // 更改控制台属性
|
_ "github.com/FloatTech/ZeroBot-Plugin/console" // 更改控制台属性
|
||||||
|
|
||||||
|
"github.com/FloatTech/ZeroBot-Plugin/kanban" // 打印 banner
|
||||||
|
|
||||||
// ---------以下插件均可通过前面加 // 注释,注释后停用并不加载插件--------- //
|
// ---------以下插件均可通过前面加 // 注释,注释后停用并不加载插件--------- //
|
||||||
// ----------------------插件优先级按顺序从高到低---------------------- //
|
// ----------------------插件优先级按顺序从高到低---------------------- //
|
||||||
// //
|
// //
|
||||||
@ -190,6 +190,8 @@ import (
|
|||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
"github.com/wdvxdr1123/ZeroBot/driver"
|
"github.com/wdvxdr1123/ZeroBot/driver"
|
||||||
"github.com/wdvxdr1123/ZeroBot/message"
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
|
|
||||||
|
"github.com/FloatTech/ZeroBot-Plugin/kanban/banner"
|
||||||
// -----------------------以上为内置依赖,勿动------------------------ //
|
// -----------------------以上为内置依赖,勿动------------------------ //
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -301,11 +303,11 @@ func main() {
|
|||||||
// 帮助
|
// 帮助
|
||||||
zero.OnFullMatchGroup([]string{"/help", ".help", "菜单"}, zero.OnlyToMe).SetBlock(true).
|
zero.OnFullMatchGroup([]string{"/help", ".help", "菜单"}, zero.OnlyToMe).SetBlock(true).
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
ctx.SendChain(message.Text(kanban.Banner, "\n管理发送\"/服务列表\"查看 bot 功能\n发送\"/用法name\"查看功能用法"))
|
ctx.SendChain(message.Text(banner.Banner, "\n管理发送\"/服务列表\"查看 bot 功能\n发送\"/用法name\"查看功能用法"))
|
||||||
})
|
})
|
||||||
zero.OnFullMatch("查看zbp公告", zero.OnlyToMe, zero.AdminPermission).SetBlock(true).
|
zero.OnFullMatch("查看zbp公告", zero.OnlyToMe, zero.AdminPermission).SetBlock(true).
|
||||||
Handle(func(ctx *zero.Ctx) {
|
Handle(func(ctx *zero.Ctx) {
|
||||||
ctx.SendChain(message.Text(kanban.Kanban()))
|
ctx.SendChain(message.Text(strings.ReplaceAll(kanban.Kanban(), "\t", "")))
|
||||||
})
|
})
|
||||||
zero.RunAndBlock(&config.Z, process.GlobalInitMutex.Unlock)
|
zero.RunAndBlock(&config.Z, process.GlobalInitMutex.Unlock)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@ import (
|
|||||||
"golang.org/x/text/cases"
|
"golang.org/x/text/cases"
|
||||||
"golang.org/x/text/language"
|
"golang.org/x/text/language"
|
||||||
|
|
||||||
"github.com/FloatTech/ZeroBot-Plugin/kanban"
|
"github.com/FloatTech/ZeroBot-Plugin/kanban/banner"
|
||||||
|
|
||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
"github.com/wdvxdr1123/ZeroBot/message"
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
@ -453,9 +453,9 @@ func drawstatus(m *ctrl.Control[*zero.Ctx], uid int64, botname string) (sendimg
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
canvas.SetRGBA255(0, 0, 0, 255)
|
canvas.SetRGBA255(0, 0, 0, 255)
|
||||||
canvas.DrawStringAnchored("Created By ZeroBot-Plugin "+kanban.Version, float64(canvas.W())/2+3, float64(canvas.H())-70/2+3, 0.5, 0.5)
|
canvas.DrawStringAnchored("Created By ZeroBot-Plugin "+banner.Version, float64(canvas.W())/2+3, float64(canvas.H())-70/2+3, 0.5, 0.5)
|
||||||
canvas.SetRGBA255(255, 255, 255, 255)
|
canvas.SetRGBA255(255, 255, 255, 255)
|
||||||
canvas.DrawStringAnchored("Created By ZeroBot-Plugin "+kanban.Version, float64(canvas.W())/2, float64(canvas.H())-70/2, 0.5, 0.5)
|
canvas.DrawStringAnchored("Created By ZeroBot-Plugin "+banner.Version, float64(canvas.W())/2, float64(canvas.H())-70/2, 0.5, 0.5)
|
||||||
|
|
||||||
sendimg = canvas.Image()
|
sendimg = canvas.Image()
|
||||||
return
|
return
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import (
|
|||||||
|
|
||||||
"github.com/disintegration/imaging"
|
"github.com/disintegration/imaging"
|
||||||
|
|
||||||
"github.com/FloatTech/ZeroBot-Plugin/kanban"
|
"github.com/FloatTech/ZeroBot-Plugin/kanban/banner"
|
||||||
|
|
||||||
"github.com/FloatTech/AnimeAPI/bilibili"
|
"github.com/FloatTech/AnimeAPI/bilibili"
|
||||||
"github.com/FloatTech/AnimeAPI/wallet"
|
"github.com/FloatTech/AnimeAPI/wallet"
|
||||||
@ -202,9 +202,9 @@ func init() {
|
|||||||
ctx.SendChain(message.Text("ERROR: ", err))
|
ctx.SendChain(message.Text("ERROR: ", err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
canvas.DrawStringAnchored("Created By Zerobot-Plugin "+kanban.Version, float64(imgDX)/2, float64(imgDY)-20, 0.5, 0.5) // zbp
|
canvas.DrawStringAnchored("Created By Zerobot-Plugin "+banner.Version, float64(imgDX)/2, float64(imgDY)-20, 0.5, 0.5) // zbp
|
||||||
canvas.SetRGB255(0, 0, 0)
|
canvas.SetRGB255(0, 0, 0)
|
||||||
canvas.DrawStringAnchored("Created By Zerobot-Plugin "+kanban.Version, float64(imgDX)/2-3, float64(imgDY)-19, 0.5, 0.5) // zbp
|
canvas.DrawStringAnchored("Created By Zerobot-Plugin "+banner.Version, float64(imgDX)/2-3, float64(imgDY)-19, 0.5, 0.5) // zbp
|
||||||
canvas.SetRGB255(255, 255, 255)
|
canvas.SetRGB255(255, 255, 255)
|
||||||
// Gradient
|
// Gradient
|
||||||
grad := gg.NewLinearGradient(20, 320, 400, 20)
|
grad := gg.NewLinearGradient(20, 320, 400, 20)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user