mirror of
https://github.com/hex-ci/smzdm_script.git
synced 2026-02-03 10:34:33 +08:00
新增抽奖关键词过滤功能
This commit is contained in:
@@ -881,7 +881,23 @@ class SmzdmTaskBot extends SmzdmBot {
|
||||
};
|
||||
}
|
||||
|
||||
const crowd = this.getOneByRandom(crowds);
|
||||
let crowd;
|
||||
|
||||
if (price > 0 && process.env.SMZDM_CROWD_KEYWORD) {
|
||||
crowd = crowds.find((item) => {
|
||||
const match = item.match(/data-title="([^"]+)"/i);
|
||||
|
||||
return (match && match[1].indexOf(process.env.SMZDM_CROWD_KEYWORD) >= 0);
|
||||
});
|
||||
|
||||
if (!crowd) {
|
||||
$.log('未找到符合关键词的抽奖,执行随机选取');
|
||||
crowd = this.getOneByRandom(crowds);
|
||||
}
|
||||
}
|
||||
else {
|
||||
crowd = this.getOneByRandom(crowds);
|
||||
}
|
||||
|
||||
const matchCrowd = crowd.match(/data-crowd_id="(\d+)"/i);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user