21 lines
546 B
TypeScript
21 lines
546 B
TypeScript
import { Context } from "../types"
|
||
|
||
/**
|
||
* 判断是否为非群聊和非艾特机器人的消息
|
||
* @param {Context} ctx - 上下文数据,包含body, logger和larkService
|
||
* @returns {boolean} 是否为非法消息
|
||
*/
|
||
export const isNotP2POrAtBot = (ctx: Context) => {
|
||
const { larkBody, appInfo } = ctx
|
||
return !larkBody.isP2P && !larkBody.isAtBot(appInfo.appName)
|
||
}
|
||
|
||
/**
|
||
* 判断是否为群聊或者艾特机器人的消息
|
||
* @param ctx
|
||
* @returns
|
||
*/
|
||
export const isP2POrAtBot = (ctx: Context) => {
|
||
return !isNotP2POrAtBot(ctx)
|
||
}
|