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