@@ -43,6 +43,7 @@ export class BiliTask {
43
43
let biliConfigData = await Config . getUserConfig ( 'bilibili' , 'config' ) ;
44
44
let biliPushData = await Config . getUserConfig ( 'bilibili' , 'push' ) ;
45
45
let interval : number = biliConfigData ?. interval || 7200 ;
46
+ logger . debug ( `当前B站功能配置:${ JSON . stringify ( biliConfigData ) } ` ) ;
46
47
const uidMap : Map < any , Map < string , any > > = new Map ( ) ; // 存放group 和 private 对应所属 uid 与推送信息的映射
47
48
const dynamicList = { } ; // 存放获取的所有动态,键为 uid,值为动态数组
48
49
@@ -207,10 +208,13 @@ export class BiliTask {
207
208
}
208
209
if ( sended ) return ; // 如果已经发送过,则直接返回
209
210
210
- let liveAtAll : boolean = biliConfigData . liveAtAll === true ? true : false ; // 直播动态是否@全体成员,默认false
211
+ let liveAtAll : boolean = ! ! biliConfigData . liveAtAll === true ? true : false ; // 直播动态是否@全体成员,默认false
211
212
let liveAtAllCD : number = biliConfigData . liveAtAllCD || 1800 ; // 直播动态@全体成员 冷却时间CD,默认 30 分钟
212
213
let liveAtAllMark : number | string | null = await Redis . get ( `${ markKey } ${ chatId } :liveAtAllMark` ) ; // 直播动态@全体成员标记,默认 0
213
- let liveAtAllGroupList = new Set ( Array . isArray ( biliConfigData . liveAtAllGroupList ) ? biliConfigData . liveAtAllGroupList : [ ] ) ; // 直播动态@全体成员的群组列表,默认空数组,为空则不进行@全体成员操作
214
+ // 直播动态@全体成员的群组列表,默认空数组,为空则不进行@全体成员操作
215
+ let liveAtAllGroupList = new Set (
216
+ Array . isArray ( biliConfigData ?. liveAtAllGroupList ) ? Array . from ( biliConfigData . liveAtAllGroupList ) . map ( item => String ( item ) ) : [ ]
217
+ ) ;
214
218
215
219
if ( ! ! biliConfigData . pushMsgMode ) {
216
220
const { data, uid } = await BiliQuery . formatDynamicData ( pushDynamicData ) ; // 处理动态数据
@@ -250,7 +254,7 @@ export class BiliTask {
250
254
251
255
global ?. logger ?. mark ( '优纪插件:B站动态执行推送' ) ;
252
256
253
- if ( liveAtAll && liveAtAllMark && extentData ?. type === 'DYNAMIC_TYPE_LIVE_RCMD' && liveAtAllGroupList . has ( chatId ) ) {
257
+ if ( liveAtAll && ! liveAtAllMark && extentData ?. type === 'DYNAMIC_TYPE_LIVE_RCMD' && liveAtAllGroupList . has ( String ( chatId ) ) ) {
254
258
try {
255
259
await this . sendMessage ( chatId , bot_id , chatType , Segment . at ( 'all' ) ) ;
256
260
await Redis . set ( `${ markKey } ${ chatId } :liveAtAllMark` , 1 , { EX : liveAtAllCD } ) ; // 设置直播动态@全体成员标记为 1
@@ -285,9 +289,9 @@ export class BiliTask {
285
289
}
286
290
287
291
let mergeTextPic : boolean = ! ! biliConfigData . mergeTextPic === false ? false : true ; // 是否合并文本和图片,默认为 true
288
- if ( mergeTextPic ) {
292
+ if ( mergeTextPic === true ) {
289
293
const mergeMsg = [ ...dynamicMsg . msg , ...dynamicMsg . pics ] ;
290
- if ( liveAtAll && liveAtAllMark && dynamicMsg . dynamicType === 'DYNAMIC_TYPE_LIVE_RCMD' && liveAtAllGroupList . has ( chatId ) ) {
294
+ if ( liveAtAll && ! liveAtAllMark && dynamicMsg . dynamicType === 'DYNAMIC_TYPE_LIVE_RCMD' && liveAtAllGroupList . has ( String ( chatId ) ) ) {
291
295
try {
292
296
await this . sendMessage ( chatId , bot_id , chatType , Segment . at ( 'all' ) ) ;
293
297
await Redis . set ( `${ markKey } ${ chatId } :liveAtAllMark` , 1 , { EX : liveAtAllCD } ) ; // 设置直播动态@全体成员标记为 1
@@ -298,7 +302,7 @@ export class BiliTask {
298
302
}
299
303
await this . sendMessage ( chatId , bot_id , chatType , mergeMsg ) ;
300
304
} else {
301
- if ( liveAtAll && liveAtAllMark && dynamicMsg . dynamicType === 'DYNAMIC_TYPE_LIVE_RCMD' && liveAtAllGroupList . has ( chatId ) ) {
305
+ if ( liveAtAll && ! liveAtAllMark && dynamicMsg . dynamicType === 'DYNAMIC_TYPE_LIVE_RCMD' && liveAtAllGroupList . has ( String ( chatId ) ) ) {
302
306
try {
303
307
await this . sendMessage ( chatId , bot_id , chatType , Segment . at ( 'all' ) ) ;
304
308
await Redis . set ( `${ markKey } ${ chatId } :liveAtAllMark` , 1 , { EX : liveAtAllCD } ) ; // 设置直播动态@全体成员标记为 1
0 commit comments