feat: 喜报/悲报支持图片
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
package xibao
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"git.lxtend.com/qqbot/handler"
|
||||
"git.lxtend.com/qqbot/model"
|
||||
"git.lxtend.com/qqbot/service/xibao"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -14,18 +18,22 @@ func init() {
|
||||
}
|
||||
|
||||
func xiBao(msg model.Message) (reply model.Reply) {
|
||||
xibao.GenerateCongratulationImage(msg.RawMsg[len("喜报 "):], "./resource/xibao_background.png", "./tmp/xibao.png", true)
|
||||
fileName := uuid.New().String()
|
||||
filePath := "./tmp/" + fileName + ".png"
|
||||
xibao.GenerateCongratulationImage(strings.Split(msg.RawMsg, " ")[1], "./resource/xibao_background.png", filePath, true)
|
||||
return model.Reply{
|
||||
ReplyMsg: "[CQ:image,file=file:///root/qqbot/tmp/xibao.png]",
|
||||
ReplyMsg: fmt.Sprintf("[CQ:image,file=file:///root/qqbot/tmp/%s]", fileName+".png"),
|
||||
ReferOriginMsg: true,
|
||||
FromMsg: msg,
|
||||
}
|
||||
}
|
||||
|
||||
func beiBao(msg model.Message) (reply model.Reply) {
|
||||
xibao.GenerateCongratulationImage(msg.RawMsg[len("悲报 "):], "./resource/beibao_background.png", "./tmp/beibao.png", false)
|
||||
fileName := uuid.New().String()
|
||||
filePath := "./tmp/" + fileName + ".png"
|
||||
xibao.GenerateCongratulationImage(strings.Split(msg.RawMsg, " ")[1], "./resource/beibao_background.png", filePath, false)
|
||||
return model.Reply{
|
||||
ReplyMsg: "[CQ:image,file=file:///root/qqbot/tmp/beibao.png]",
|
||||
ReplyMsg: fmt.Sprintf("[CQ:image,file=file:///root/qqbot/tmp/%s]", fileName+".png"),
|
||||
ReferOriginMsg: true,
|
||||
FromMsg: msg,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user