Skip to content

Commit

Permalink
🐛 对图像的特殊处理 (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
guohuiyuan authored Apr 23, 2024
1 parent 0945be2 commit 58ad4b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions aireply/lolimi.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ func (l *LolimiAi) TalkPlain(_ int64, msg, nickname string) string {
return "ERROR: " + err.Error()
}
replystr := gjson.Get(binary.BytesToString(data), "data.output").String()
replystr = strings.ReplaceAll(replystr, "<img src=\"", "[CQ:image,file=")
replystr = strings.ReplaceAll(replystr, "<br>", "\n")
replystr = strings.ReplaceAll(replystr, "\" />", "]")
textReply := strings.ReplaceAll(replystr, l.n, nickname)
for _, w := range l.b {
if strings.Contains(textReply, w) {
Expand Down
2 changes: 2 additions & 0 deletions tts/lolimi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package lolimi

import (
"fmt"
"strings"

"github.com/FloatTech/floatbox/binary"
"github.com/FloatTech/floatbox/web"
Expand Down Expand Up @@ -43,6 +44,7 @@ func TTS(name string, text string) (recURL string, err error) {
data []byte
ok bool
)
text = strings.ReplaceAll(text, " ", "")
ttsURL, ok = lolimiMap[name]
if !ok {
ttsURL = fmt.Sprintf(genshinURL, text, name)
Expand Down

0 comments on commit 58ad4b8

Please sign in to comment.