diff --git a/lib/core/monitor.js b/lib/core/monitor.js index eac3706..7fb338d 100644 --- a/lib/core/monitor.js +++ b/lib/core/monitor.js @@ -365,7 +365,7 @@ class Monitor extends Searcher { log.debug('正在筛选的动态信息', lottery_info); if (des === '') { - log.info('筛选动态', `获取动态内容为空(https://t.bilibili.com/${dyid})风控`); + log.info('筛选动态', `获取动态内容为空(https://t.bilibili.com/${dyid})风控或是视频动态`); return false; } @@ -472,11 +472,27 @@ class Monitor extends Searcher { ); try { let msg_json = JSON.parse(msg); - has_key_words = msg_json.has_key_words; - needAt = msg_json.needAt; - needTopic = msg_json.needTopic; - drawtime = msg_json.drawtime; - isLottery = has_key_words; + if (typeof msg_json.has_key_words == 'boolean') { + has_key_words = msg_json.has_key_words; + isLottery = has_key_words; + } else { + log.warn('ai判断抽奖', 'no has_key_words'); + } + if (typeof msg_json.needAt == 'boolean') { + needAt = msg_json.needAt; + } else { + log.warn('ai判断抽奖', 'no needAt'); + } + if (typeof msg_json.needTopic == 'string') { + needTopic = msg_json.needTopic; + } else { + log.warn('ai判断抽奖', 'no needTopic'); + } + if (typeof msg_json.drawtime == 'number') { + drawtime = msg_json.drawtime; + } else { + log.warn('ai判断抽奖', 'no drawtime'); + } log.info('ai判断抽奖', msg_json.more); } catch (_) { log.error('ai判断抽奖', `未返回JSON格式${msg}`); diff --git a/lib/utils.js b/lib/utils.js index a222ba9..58847b6 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -550,7 +550,7 @@ const utils = { }, success: res => { const data = utils.strToJson(res.body); - resolve(data?.choices?.[0]?.message?.content || null); + resolve(utils.log.debug_return(content, data?.choices?.[0]?.message?.content) || null); }, failure: () => { resolve(null);