This commit is contained in:
ZM.J 2024-07-25 16:26:10 +08:00
parent 74d4441e67
commit b764e5cd77

View file

@ -97,7 +97,7 @@ export class Guide extends ZZZPlugin {
, ,
, ,
isUpdate, isUpdate,
name, atlas,
group = _.get(settings.getConfig('guide'), 'default_guide', 1).toString(), group = _.get(settings.getConfig('guide'), 'default_guide', 1).toString(),
] = this.e.msg.match(reg); ] = this.e.msg.match(reg);
// all -> 0 // all -> 0
@ -109,8 +109,8 @@ export class Guide extends ZZZPlugin {
await this.reply(`超过攻略数量(${this.maxNum}`); await this.reply(`超过攻略数量(${this.maxNum}`);
return; return;
} }
let id = atlasToName(name); let name = atlasToName(atlas);
if (!id) { if (!name) {
await this.reply('该角色不存在'); await this.reply('该角色不存在');
return; return;
} }
@ -161,10 +161,13 @@ export class Guide extends ZZZPlugin {
return false; return false;
} }
// 搜索时过滤特殊符号譬如「11号」
const filtered_name = name.replace(/[^\w\s]|_/g, '')
let posts = lodash.flatten(lodash.map(mysRes, item => item.data.posts)); let posts = lodash.flatten(lodash.map(mysRes, item => item.data.posts));
let url, created_at, updated_at; let url, created_at, updated_at;
for (let val of posts) { for (let val of posts) {
if (val.post.subject.replace(/【[^】]*本[^】]*】/g, '').includes(name)) { if (val.post.subject.replace(/【[^】]*本[^】]*】/g, '').includes(filtered_name)) {
let max = 0; let max = 0;
val.image_list.forEach((v, i) => { val.image_list.forEach((v, i) => {
if ( if (