Skip to content

Commit

Permalink
fix(waline): Remove reply AT tag
Browse files Browse the repository at this point in the history
Signed-off-by: qwqcode <[email protected]>
  • Loading branch information
qwqcode committed Apr 25, 2022
1 parent e307e2a commit 3e44c6c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions waline/waline.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package waline

import "github.com/ArtalkJS/Artransfer-CLI/lib"
import (
"regexp"
"strings"

"github.com/ArtalkJS/Artransfer-CLI/lib"
)

type WalineCmd struct {
}
Expand All @@ -23,10 +28,16 @@ func WalineToArtrans(wComments []Comment) []lib.Artran {
artrans := []lib.Artran{}

for _, wC := range wComments {
content := strings.TrimSpace(wC.Comment)

// 移除 "[@USERNAME](#rid): "
replyAtMatcher := regexp.MustCompile(`^\[@(.*?)\]\(#[a-zA-Z0-9]+?\)(: )?`)
content = replyAtMatcher.ReplaceAllString(content, "")

artran := lib.Artran{
ID: lib.ToString(wC.ID),
Rid: lib.ToString(wC.Rid),
Content: wC.Comment,
Content: content,
UA: wC.Ua,
IP: wC.Ip,
IsPending: lib.ToString(wC.Status == "waiting"),
Expand Down

1 comment on commit 3e44c6c

@qwqcode
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.