Skip to content

Commit

Permalink
update: comment filter sub comment
Browse files Browse the repository at this point in the history
  • Loading branch information
festoney8 committed Nov 22, 2024
1 parent d0ba183 commit 32695f7
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/modules/filters/variety/comment/pages/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ const selectorFns = {
.replace('@', '')
.trim()
},
callUserNoReply: (comment: HTMLElement): SelectorResult => {
return (comment as any).__data?.content?.message
?.trim()
?.replace(/^回复\s?@[^@\s]+\s?:/, '')
?.match(/@[^@\s]+/)?.[0]
.replace('@', '')
.trim()
},
callUserOnly: (comment: HTMLElement): SelectorResult => {
return (
(comment as any).__data?.content?.message
Expand All @@ -194,6 +202,15 @@ const selectorFns = {
.trim() === ''
)
},
callUserOnlyNoReply: (comment: HTMLElement): SelectorResult => {
return (
(comment as any).__data?.content?.message
?.trim()
?.replace(/^回复\s?@[^@\s]+\s?:/, '')
?.replace(/@[^@\s]+/g, ' ')
.trim() === ''
)
},
level: (comment: HTMLElement): SelectorResult => {
return (comment as any).__data?.member?.level_info?.current_level
},
Expand Down Expand Up @@ -376,7 +393,9 @@ class CommentFilterCommon implements IMainFilter {
this.commentBotFilter.isEnable ||
this.commentCallBotFilter.isEnable ||
this.commentCallUserFilter.isEnable ||
this.commentCallUserOnlyFilter.isEnable
this.commentCallUserNoReplyFilter.isEnable ||
this.commentCallUserOnlyFilter.isEnable ||
this.commentCallUserOnlyNoReplyFilter.isEnable
)
) {
revertAll = true
Expand All @@ -403,7 +422,9 @@ class CommentFilterCommon implements IMainFilter {
`username: ${selectorFns.sub.username(v)}`,
`content: ${selectorFns.sub.content(v)}`,
`callUser: ${selectorFns.sub.callUser(v)}`,
`callUserNoReply: ${selectorFns.sub.callUserNoReply(v)}`,
`callUserOnly: ${selectorFns.sub.callUserOnly(v)}`,
`callUserOnlyNoReply: ${selectorFns.sub.callUserOnlyNoReply(v)}`,
`level: ${selectorFns.sub.level(v)}`,
`isUp: ${selectorFns.sub.isUp(v)}`,
`isLink: ${selectorFns.sub.isLink(v)}`,
Expand All @@ -425,8 +446,12 @@ class CommentFilterCommon implements IMainFilter {
this.commentBotFilter.isEnable && blackPairs.push([this.commentBotFilter, selectorFns.sub.username])
this.commentCallBotFilter.isEnable && blackPairs.push([this.commentCallBotFilter, selectorFns.sub.callUser])
this.commentCallUserFilter.isEnable && blackPairs.push([this.commentCallUserFilter, selectorFns.sub.callUser])
this.commentCallUserNoReplyFilter.isEnable &&
blackPairs.push([this.commentCallUserNoReplyFilter, selectorFns.sub.callUserNoReply])
this.commentCallUserOnlyFilter.isEnable &&
blackPairs.push([this.commentCallUserOnlyFilter, selectorFns.sub.callUserOnly])
this.commentCallUserOnlyNoReplyFilter.isEnable &&
blackPairs.push([this.commentCallUserOnlyNoReplyFilter, selectorFns.sub.callUserOnlyNoReply])

const whitePairs: SubFilterPair[] = []
this.commentIsUpFilter.isEnable && whitePairs.push([this.commentIsUpFilter, selectorFns.sub.isUp])
Expand Down

0 comments on commit 32695f7

Please sign in to comment.