Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 对图像的特殊处理 #49

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading