mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
feat: 热评包含发送热评的人的昵称换成自己的昵称 (#239)
This commit is contained in:
parent
5ae7801086
commit
7b9d251e80
@ -598,7 +598,12 @@ class Monitor extends Searcher {
|
|||||||
/* 评论 */
|
/* 评论 */
|
||||||
if (rid && chat_type) {
|
if (rid && chat_type) {
|
||||||
if (is_copy_chat) {
|
if (is_copy_chat) {
|
||||||
chat = getRandomOne(await bili.getChat(rid, chat_type)) || "!!!"
|
const copy_chat = getRandomOne(await bili.getChat(rid, chat_type));
|
||||||
|
chat = copy_chat[1]
|
||||||
|
.replace(
|
||||||
|
new RegExp(copy_chat[0], 'g'),
|
||||||
|
global_var.get("myUNAME") || '')
|
||||||
|
|| "!!!"
|
||||||
}
|
}
|
||||||
|
|
||||||
status = await retryfn(
|
status = await retryfn(
|
||||||
|
|||||||
@ -143,6 +143,7 @@ const bili_client = {
|
|||||||
}),
|
}),
|
||||||
res = strToJson(responseText);
|
res = strToJson(responseText);
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
|
GlobalVar.set("myUNAME", res.data.name)
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -1056,7 +1057,7 @@ const bili_client = {
|
|||||||
* 查询评论
|
* 查询评论
|
||||||
* @param {*} rid
|
* @param {*} rid
|
||||||
* @param {*} type
|
* @param {*} type
|
||||||
* @returns {Promise<Array<string>>}
|
* @returns {Promise<Array<[string,string]>>} [[uname,chat],]
|
||||||
*/
|
*/
|
||||||
async getChat(rid, type) {
|
async getChat(rid, type) {
|
||||||
const
|
const
|
||||||
@ -1072,7 +1073,7 @@ const bili_client = {
|
|||||||
case 0:
|
case 0:
|
||||||
log.info('查询评论', `成功`);
|
log.info('查询评论', `成功`);
|
||||||
try {
|
try {
|
||||||
return res.data.replies.map(it => it.content.message);
|
return res.data.replies.map(it => [it.member.uname, it.content.message]);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,6 @@ const searcher = require("../lib/core/searcher");
|
|||||||
const util = require('./util');
|
const util = require('./util');
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
assert(await bili_client.getMyinfo());
|
|
||||||
|
|
||||||
await util.par_run([0, 1, 2, 3], [
|
await util.par_run([0, 1, 2, 3], [
|
||||||
// 0
|
// 0
|
||||||
async () => {
|
async () => {
|
||||||
@ -21,7 +19,7 @@ const util = require('./util');
|
|||||||
async () => {
|
async () => {
|
||||||
let card = searcher.parseDynamicCard(await bili_client.getOneDynamicByDyid("746824225190314008"));
|
let card = searcher.parseDynamicCard(await bili_client.getOneDynamicByDyid("746824225190314008"));
|
||||||
let chats = await bili_client.getChat(card.rid_str, card.chat_type)
|
let chats = await bili_client.getChat(card.rid_str, card.chat_type)
|
||||||
assert(chats.length > 0 && typeof chats[0] == "string")
|
assert(chats.length > 0 && typeof chats[0][0] == "string")
|
||||||
},
|
},
|
||||||
// 3
|
// 3
|
||||||
async () => {
|
async () => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user