🏠 Home 

Bilibili直播间助手

提供同传弹幕过滤,快速切换牌子,自动切换直播清晰度等功能

< 脚本Bilibili直播间助手的反馈

提问/评论

§
发表于:2022-05-10
编辑于:2022-05-10

第810行左右,medalInfo.medal_id !== this.medalConfig.wore,是否该为medalInfo.medal_name !== this.medalConfig.wore?貌似即使带的牌子是当前直播间的,依然会走进if发送佩戴请求

§
发表于:2022-05-10

这样,去掉else?

if (medalInfo && medalInfo.medal_name !== this.medalConfig.wore) {
this.wear(medalInfo.medal_id).catch(e => {
setTimeout(() => {
if (this.medalConfig.autoWear.remember !== 0) {
this.wear(this.medalConfig.autoWear.remember).catch(e => { });
} else {
this.takeOff();
}
}, 1500);
});
}
§
发表于:2022-05-10

只赋值一次medalConfig

autoWear() {
this.getWore().then(res => {
return res.length == 0 ? ("", "c0c0c0") : (res.medal_name, res.medal_color_start.toString(16));
}).then((wore, color) => {
if (window.__NEPTUNE_IS_MY_WAIFU__ && this.medalConfig.autoWear.enable) {
let medalInfo = window.__NEPTUNE_IS_MY_WAIFU__.roomInfoRes.data.anchor_info.medal_info;
if (medalInfo && medalInfo.medal_name !== wore) {
this.wear(medalInfo.medal_id).catch(e => {
setTimeout(() => {
if (this.medalConfig.autoWear.remember !== 0) {
this.wear(this.medalConfig.autoWear.remember).catch(e => { });
} else {
this.takeOff();
}
}, 1500);
});
return;
}
}
this.medalConfig.wore = wore;
this.medalConfig.color = color;
})
},
§
发表于:2022-05-10

只赋值一次medalConfig

autoWear() {
this.getWore().then(res => {
return res.length == 0 ? ("", "c0c0c0") : (res.medal_name, res.medal_color_start.toString(16));
}).then((wore, color) => {
if (window.__NEPTUNE_IS_MY_WAIFU__ && this.medalConfig.autoWear.enable) {
let medalInfo = window.__NEPTUNE_IS_MY_WAIFU__.roomInfoRes.data.anchor_info.medal_info;
if (medalInfo && medalInfo.medal_name !== wore) {
this.wear(medalInfo.medal_id).catch(e => {
setTimeout(() => {
if (this.medalConfig.autoWear.remember !== 0) {
this.wear(this.medalConfig.autoWear.remember).catch(e => { });
} else {
this.takeOff();
}
}, 1500);
});
return;
}
}
this.medalConfig.wore = wore;
this.medalConfig.color = color;
})
},

javascript苦手……写错了两行。

autoWear() {
this.getWore().then(res => {
return res.length == 0 ? ["", "c0c0c0"] : [res.medal_name, res.medal_color_start.toString(16)];
}).then(([wore, color]) => {
if (window.__NEPTUNE_IS_MY_WAIFU__ && this.medalConfig.autoWear.enable) {
let medalInfo = window.__NEPTUNE_IS_MY_WAIFU__.roomInfoRes.data.anchor_info.medal_info;
if (medalInfo && medalInfo.medal_name !== wore) {
this.wear(medalInfo.medal_id).catch(e => {
setTimeout(() => {
if (this.medalConfig.autoWear.remember !== 0) {
this.wear(this.medalConfig.autoWear.remember).catch(e => { });
} else {
this.takeOff();
}
}, 1500);
});
return;
}
}
this.medalConfig.wore = wore;
this.medalConfig.color = color;
})
},

发表回复

登录以发表回复。