Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion data
Submodule data updated 1 files
+1 −1 Wife
15 changes: 13 additions & 2 deletions plugin/wife/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package wife

import (
"encoding/json"
"fmt"
"os"
"regexp"
"strings"

fcext "github.com/FloatTech/floatbox/ctxext"
Expand Down Expand Up @@ -51,14 +53,23 @@ func init() {
)
return
}
re := regexp.MustCompile(`^\[(.*?)\](.*)\..*$`)
match := re.FindStringSubmatch(card)
var msgText string
if len(match) == 3 {
work, name := match[1], match[2]
msgText = fmt.Sprintf("今天的二次元老婆是~来自【%s】的【%s】哒", work, name)
} else {
msgText = fmt.Sprintf("今天的二次元老婆是~【%s】哒", card)
}
if id := ctx.SendChain(
message.At(ctx.Event.UserID),
message.Text("今天的二次元老婆是~【", card, "】哒"),
message.Text(msgText),
message.ImageBytes(data),
); id.ID() == 0 {
ctx.SendChain(
message.At(ctx.Event.UserID),
message.Text("今天的二次元老婆是~【", card, "】哒\n【图片发送失败, 请联系维护者】"),
message.Text(msgText, "\n【图片发送失败, 多半是被夹了,请联系维护者】"),
)
}
})
Expand Down
Loading