feat: 添加悲报

This commit is contained in:
lixiangwuxian 2024-10-11 00:13:42 +08:00
parent abd9531fb0
commit 7aebdeae56
3 changed files with 12 additions and 2 deletions

View File

@ -8,10 +8,11 @@ import (
func init() { func init() {
handler.RegisterHandler("喜报", xiBao) handler.RegisterHandler("喜报", xiBao)
handler.RegisterHandler("悲报", beiBao)
} }
func xiBao(msg model.Message) (reply model.Reply) { func xiBao(msg model.Message) (reply model.Reply) {
xibao.GenerateCongratulationImage(msg.Msg[len("喜报 "):], "./tmp/xibao.png") xibao.GenerateCongratulationImage(msg.Msg[len("喜报 "):], "./resource/xibao_background.png", "./tmp/xibao.png", true)
return model.Reply{ return model.Reply{
ReplyMsg: "[CQ:image,file=file:///root/qqbot/tmp/xibao.png]", ReplyMsg: "[CQ:image,file=file:///root/qqbot/tmp/xibao.png]",
ReferOriginMsg: true, ReferOriginMsg: true,
@ -19,4 +20,11 @@ func xiBao(msg model.Message) (reply model.Reply) {
} }
} }
//docker run -d --name qqbot -v /root/qqbot:/root/qqbot -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro --restart=always qqbot func beiBao(msg model.Message) (reply model.Reply) {
xibao.GenerateCongratulationImage(msg.Msg[len("悲报 "):], "./resource/beibao_background.png", "./tmp/beibao.png", false)
return model.Reply{
ReplyMsg: "[CQ:image,file=file:///root/qqbot/tmp/beibao.png]",
ReferOriginMsg: true,
FromMsg: msg,
}
}

View File

@ -4,11 +4,13 @@ import (
"log" "log"
"time" "time"
"git.lxtend.com/qqbot/sqlite3"
wsclient "git.lxtend.com/qqbot/ws_client" wsclient "git.lxtend.com/qqbot/ws_client"
) )
func main() { func main() {
// 创建 WebSocket 客户端 // 创建 WebSocket 客户端
sqlite3.InitDB()
client, err := wsclient.NewWebSocketClient("ws", "localhost:3001", "") client, err := wsclient.NewWebSocketClient("ws", "localhost:3001", "")
if err != nil { if err != nil {
log.Print("Error creating WebSocket client:", err) log.Print("Error creating WebSocket client:", err)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB