File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -89,17 +89,21 @@ for (const [botName, config] of Object.entries(configs)) {
8989 if ( message . reply_markup ?. inline_keyboard ) {
9090 matchCount += 2 ;
9191 }
92+ if ( message . entities ) {
93+ matchCount += message . entities . filter ( e => e . type === 'url' ) . length ;
94+ }
9295 if ( message . caption_entities ) {
93- matchCount += message . caption_entities . filter ( e => e . type === 'text_link' ) . length / 2 ;
96+ matchCount += message . caption_entities . filter ( e => e . type === 'text_link' ) . length ;
9497 }
98+ const isAdmin = config . adminChatIds ?. includes ( currentChat . id )
9599 // 有按钮就认为是垃圾消息(让管理员可见以方便测试)
96100 if ( matchCount >= 2 ) {
97- await sendMessageToCurrentChat ( `\`filtered by firewall(${ matchCount } )\`` , {
101+ await sendMessageToCurrentChat ( `\`filtered by firewall(${ isAdmin ? 'weight=' + matchCount : ( new Date ( ) . getMilliseconds ( ) + 10 ) % 30 } )\`` , {
98102 parse_mode : 'MarkdownV2'
99103 } )
100104 return
101105 }
102- if ( config . adminChatIds ?. includes ( currentChat . id ) && isPrivate ) return
106+ if ( isAdmin && isPrivate ) return
103107 const shortcut = config . list . find ( ( el ) => el . id === currentChatId ) ?. name
104108
105109 for ( const el of config . adminChatIds || [ ] ) {
You can’t perform that action at this time.
0 commit comments