fix: 未知错误 已赞过 (#249)

Fixed #249
This commit is contained in:
shanmite 2023-02-12 10:47:16 +08:00
parent 7f6188d510
commit 8ac7466878
3 changed files with 17 additions and 5 deletions

View File

@ -197,6 +197,7 @@ class Monitor extends Searcher {
case 4001:
case 4002:
case 4003:
case 4004:
case 5002:
case 5003:
case 5004:
@ -215,6 +216,8 @@ class Monitor extends Searcher {
case 5001:
is_shutdown = true
break;
default:
break;
}
if (is_shutdown) break
@ -569,6 +572,7 @@ class Monitor extends Searcher {
* - 点赞 未知错误 4001
* - 点赞 点赞异常 4002
* - 点赞 点赞频繁 4003
* - 点赞 已赞过 4004
* - 转发 未知错误 5001
* - 转发 该动态不能转发分享 5002
* - 转发 请求数据发生错误请刷新或稍后重试 5003
@ -646,7 +650,7 @@ class Monitor extends Searcher {
if (!check_if_duplicated || check_if_duplicated === 3) {
status = await retryfn(
5,
[1, 2, 3],
[3],
() => bili.autolike(dyid)
)

View File

@ -733,9 +733,10 @@ const bili_client = {
* @param {string} dyid
* @returns {Promise<number>}
* - 成功 0
* - 未知错误 1
* - 点赞异常 2
* - 点赞频繁 3
* - 未知错误 1
* - 点赞异常 2
* - 点赞频繁 3
* - 已赞过 4
*/
async autolike(dyid) {
const
@ -759,6 +760,9 @@ const bili_client = {
case 1000001:
log.warn('自动点赞', '点赞频繁');
return 3;
case 65006:
log.warn('自动点赞', '已赞过');
return 4;
default:
log.error('自动点赞', `未知错误\n${responseText}`);
return 1;

View File

@ -5,7 +5,7 @@ const util = require('./util');
(async () => {
assert(await bili_client.getMyinfo());
await util.par_run([0, 1, 2, 3, 4], [
await util.par_run([0, 1, 2, 3, 4, 6], [
// 0
async () => {
assert.equal((await bili_client.getTopRcmd()).length, 10)
@ -39,6 +39,10 @@ const util = require('./util');
// 5
async () => {
assert(!await bili_client.createDynamic("1"))
},
// 6
async () => {
assert.equal(await bili_client.autolike("761391835139538967"), 4)
}
])