feat: 修复在群聊中判断机器人是否被AT的条件
All checks were successful
Egg Server CI/CD / build-image (push) Successful in 1m59s
Egg Server CI/CD / refresh-image (push) Successful in 13s
Egg Server CI/CD / fast-deploy (push) Successful in 3s

This commit is contained in:
zhaoyingbo 2024-10-29 07:56:04 +00:00
parent d14226bcef
commit 61fa783410

View File

@ -10,14 +10,16 @@ import groupAgent from "./groupAgent"
* P2P或者群聊并且艾特了机器人
* @param larkBody
*/
const getIsP2pOrGroupAtBot = async (larkBody: LarkBody): Promise<boolean> => {
const appList = (await db.appInfo.getFullList())
.map((v) => v.app_name)
.filter((v) => v)
const getIsP2pOrGroupAtBot = async (
larkBody: LarkBody,
app: string
): Promise<boolean> => {
const appName = (await db.appInfo.getFullList()).find(
(v) => v.name === app
)?.app_name
const isP2p = larkBody.chatType === "p2p"
const isAtBot = larkBody.mentions?.some?.((mention) =>
appList.includes(mention.name)
const isAtBot = larkBody.mentions?.some?.(
(mention) => mention.name === appName
)
return Boolean(isP2p || isAtBot)
}