Skip to content

Commit 16d8897

Browse files
committed
改进文本
1 parent 3f399d0 commit 16d8897

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

bot/handlers_admin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ func postArtworkCb(ctx context.Context, bot *telego.Bot, query telego.CallbackQu
266266
go bot.EditMessageCaption(&telego.EditMessageCaptionParams{
267267
ChatID: telegoutil.ID(query.Message.GetChat().ID),
268268
MessageID: query.Message.GetMessageID(),
269-
Caption: "正在发布...",
269+
Caption: fmt.Sprintf("正在发布: %s", artwork.SourceURL),
270270
ReplyMarkup: nil,
271271
})
272272
if service.CheckDeletedByURL(ctx, sourceURL) {

bot/handlers_common.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ func getArtworkInfo(ctx context.Context, bot *telego.Bot, message telego.Message
324324
if deletedModel != nil && hasPermission {
325325
photo.WithCaption(artworkInfoCaption + fmt.Sprintf("\n\n这是一个在 %s 删除的作品\n如果发布则会取消删除", deletedModel.DeletedAt.Time().Format("2006-01-02 15:04:05")))
326326
} else {
327-
artworkInfoCaption += fmt.Sprintf("\n\n该作品共有%d张图片", len(artwork.Pictures))
327+
artworkInfoCaption += fmt.Sprintf("\n该作品共有%d张图片", len(artwork.Pictures))
328328
photo.WithCaption(artworkInfoCaption)
329329
}
330330
if isAlreadyPosted {

cmd/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
)
88

99
const (
10-
Version string = "0.9.2"
10+
Version string = "0.9.3"
1111
)
1212

1313
var VersionCmd = &cobra.Command{

sources/kemono/types.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import (
55
"ManyACG/types"
66
"fmt"
77
"net/http"
8+
"regexp"
89
"strconv"
10+
"strings"
911
)
1012

1113
type KemonoPostResp struct {
@@ -34,6 +36,8 @@ type KemonoCreatorProfileResp struct {
3436
PubilcID string `json:"public_id"` // username
3537
}
3638

39+
var htmlRe = regexp.MustCompile("<[^>]+>")
40+
3741
func (resp *KemonoPostResp) ToArtwork() (*types.Artwork, error) {
3842
creatorResp, err := getAuthorProfile(resp.Service, resp.User)
3943
if err != nil {
@@ -100,7 +104,7 @@ func (resp *KemonoPostResp) ToArtwork() (*types.Artwork, error) {
100104
}
101105
artwork := &types.Artwork{
102106
Title: resp.Title,
103-
Description: resp.Content,
107+
Description: htmlRe.ReplaceAllString(strings.ReplaceAll(resp.Content, "<br/>", "\n"), ""),
104108
R18: false,
105109
SourceType: types.SourceTypeKemono,
106110
SourceURL: fmt.Sprintf("https://kemono.su/%s/user/%s/post/%s", resp.Service, resp.User, resp.ID),

0 commit comments

Comments
 (0)