mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🦄 reactor: 重构tieba
解析
This commit is contained in:
parent
7d4839c10b
commit
523bca933e
@ -1918,21 +1918,31 @@ export class tools extends plugin {
|
|||||||
}
|
}
|
||||||
e.reply(sendContent, true);
|
e.reply(sendContent, true);
|
||||||
const others = postList.slice(1);
|
const others = postList.slice(1);
|
||||||
const reply = others.map(item => {
|
const reply = others.flatMap(item => {
|
||||||
if (item?.content?.[0]?.cdn_src !== undefined) {
|
if (!item.content || item.content.length === 0) return [];
|
||||||
return {
|
|
||||||
message: segment.image(item?.content?.[0]?.cdn_src),
|
return item.content.map(floor => {
|
||||||
|
const commonData = {
|
||||||
nickname: e.sender.card || e.user_id,
|
nickname: e.sender.card || e.user_id,
|
||||||
user_id: e.user_id,
|
user_id: e.user_id,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (floor?.cdn_src) {
|
||||||
|
return {
|
||||||
|
...commonData,
|
||||||
|
message: segment.image(floor.cdn_src)
|
||||||
|
};
|
||||||
|
} else if (floor?.text) {
|
||||||
|
return {
|
||||||
|
...commonData,
|
||||||
|
message: { type: 'text', text: floor.text || '-' }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
} else if (item?.content?.[0]?.text !== undefined) {
|
|
||||||
return {
|
return null;
|
||||||
message: { type: 'text', text: item?.content?.[0].text || '-'},
|
}).filter(Boolean); // 过滤掉 null 的值
|
||||||
nickname: e.sender.card || e.user_id,
|
|
||||||
user_id: e.user_id,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
e.reply(await Bot.makeForwardMsg(reply));
|
e.reply(await Bot.makeForwardMsg(reply));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user