refactor: streamline UnRegisterLiveHandler calls in xiBaoTemp and beiBaoTemp functions
This commit is contained in:
parent
e14023a59d
commit
d2fc755df5
@ -40,10 +40,10 @@ func xiBao(msg model.Message) (reply model.Reply) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func xiBaoTemp(msg model.Message) (reply model.Reply, isTrigger bool) {
|
func xiBaoTemp(msg model.Message) (reply model.Reply, isTrigger bool) {
|
||||||
|
handler.UnRegisterLiveHandler(msg.GroupInfo.GroupId, msg.UserId)
|
||||||
fileName := uuid.New().String()
|
fileName := uuid.New().String()
|
||||||
filePath := "./tmp/" + fileName + ".png"
|
filePath := "./tmp/" + fileName + ".png"
|
||||||
xibao.GenerateCongratulationImage(msg.RawMsg, "./resource/xibao_background.png", filePath, true)
|
xibao.GenerateCongratulationImage(msg.RawMsg, "./resource/xibao_background.png", filePath, true)
|
||||||
handler.UnRegisterLiveHandler(msg.GroupInfo.GroupId, msg.UserId)
|
|
||||||
return model.Reply{
|
return model.Reply{
|
||||||
ReplyMsg: fmt.Sprintf("[CQ:image,file=file:///root/qqbot/tmp/%s]", fileName+".png"),
|
ReplyMsg: fmt.Sprintf("[CQ:image,file=file:///root/qqbot/tmp/%s]", fileName+".png"),
|
||||||
ReferOriginMsg: true,
|
ReferOriginMsg: true,
|
||||||
@ -73,10 +73,10 @@ func beiBao(msg model.Message) (reply model.Reply) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func beiBaoTemp(msg model.Message) (reply model.Reply, isTrigger bool) {
|
func beiBaoTemp(msg model.Message) (reply model.Reply, isTrigger bool) {
|
||||||
|
handler.UnRegisterLiveHandler(msg.GroupInfo.GroupId, msg.UserId)
|
||||||
fileName := uuid.New().String()
|
fileName := uuid.New().String()
|
||||||
filePath := "./tmp/" + fileName + ".png"
|
filePath := "./tmp/" + fileName + ".png"
|
||||||
xibao.GenerateCongratulationImage(msg.RawMsg, "./resource/beibao_background.png", filePath, false)
|
xibao.GenerateCongratulationImage(msg.RawMsg, "./resource/beibao_background.png", filePath, false)
|
||||||
handler.UnRegisterLiveHandler(msg.GroupInfo.GroupId, msg.UserId)
|
|
||||||
return model.Reply{
|
return model.Reply{
|
||||||
ReplyMsg: fmt.Sprintf("[CQ:image,file=file:///root/qqbot/tmp/%s]", fileName+".png"),
|
ReplyMsg: fmt.Sprintf("[CQ:image,file=file:///root/qqbot/tmp/%s]", fileName+".png"),
|
||||||
ReferOriginMsg: true,
|
ReferOriginMsg: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user