mirror of
https://github.com/Jerryplusy/crystelf-plugin.git
synced 2025-12-05 15:41:56 +00:00
fix(ai): 修正字符串匹配失败和回复逻辑
This commit is contained in:
parent
d72db21461
commit
a9a494ddc1
10
apps/ai.js
10
apps/ai.js
@ -89,11 +89,11 @@ async function index(e) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.user_id === e.bot.uin) {
|
if (e.user_id === e.bot.uin) {
|
||||||
return e.reply(segment.image(await Meme.getMeme(aiConfig.character, 'default')));
|
return;
|
||||||
}
|
}
|
||||||
const userMessage = await extractUserMessage(e.msg, nickname, e);
|
const userMessage = await extractUserMessage(e.msg, nickname, e);
|
||||||
if (!userMessage || userMessage.length === 0) {
|
if (!userMessage || userMessage.length === 0) {
|
||||||
return;
|
return e.reply(segment.image(await Meme.getMeme(aiConfig.character, 'default')));
|
||||||
}
|
}
|
||||||
const adapter = await YunzaiUtils.getAdapter(e);
|
const adapter = await YunzaiUtils.getAdapter(e);
|
||||||
await Message.emojiLike(e, e.message_id, 128064, e.group_id, adapter); //👀
|
await Message.emojiLike(e, e.message_id, 128064, e.group_id, adapter); //👀
|
||||||
@ -130,7 +130,7 @@ async function extractUserMessage(msg, nickname, e) {
|
|||||||
returnMessage += `[${e.sender?.nickname},id:${e.user_id}]说:${message}\n`;
|
returnMessage += `[${e.sender?.nickname},id:${e.user_id}]说:${message}\n`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if(at.length === 1 && at[0] === e.bot.uin){
|
if(at.length == 1 && at[0] == e.bot.uin){
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if (at.length > 0) {
|
if (at.length > 0) {
|
||||||
@ -148,8 +148,8 @@ async function extractUserMessage(msg, nickname, e) {
|
|||||||
}
|
}
|
||||||
return returnMessage;
|
return returnMessage;
|
||||||
}
|
}
|
||||||
logger.warn('[crystelf-ai] 字符串匹配失败,使用空字符串操作');
|
logger.warn('[crystelf-ai] 字符串匹配失败');
|
||||||
return [''];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user