feat: 修复在群聊中判断机器人是否被AT的条件
This commit is contained in:
parent
d14226bcef
commit
61fa783410
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user