mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-10-10 10:18:41 +08:00
feat: 统一发送能力 接入退群通知与定时日报
This commit is contained in:
@@ -32,7 +32,6 @@ export interface WechatActionGatewayDependencies {
|
||||
| WechatActionMemberEventReference
|
||||
| Promise<WechatActionMemberEventReference | undefined>
|
||||
| undefined
|
||||
checkEntitlement?: (request: WechatActionRequest) => boolean | Promise<boolean>
|
||||
getUserDataPath?: () => string
|
||||
now?: () => Date
|
||||
}
|
||||
@@ -140,33 +139,6 @@ export class WechatActionGateway {
|
||||
)
|
||||
}
|
||||
|
||||
let entitled = true
|
||||
try {
|
||||
entitled = this.deps.checkEntitlement
|
||||
? await this.deps.checkEntitlement(request)
|
||||
: await checkEntitlement(request)
|
||||
} catch (error) {
|
||||
entitled = false
|
||||
return this.finishBlocked(
|
||||
actionId,
|
||||
request,
|
||||
idempotencyKey,
|
||||
startedAt,
|
||||
'POLICY_BLOCKED',
|
||||
error instanceof Error ? error.message : String(error)
|
||||
)
|
||||
}
|
||||
if (!entitled) {
|
||||
return this.finishBlocked(
|
||||
actionId,
|
||||
request,
|
||||
idempotencyKey,
|
||||
startedAt,
|
||||
'POLICY_BLOCKED',
|
||||
'该发送动作未获得当前账号的使用权限'
|
||||
)
|
||||
}
|
||||
|
||||
const capabilityType = request.content.type
|
||||
let capability: PersonalWechatSendCapability | undefined
|
||||
try {
|
||||
@@ -483,12 +455,6 @@ export function shouldUseAiPolicy(request: WechatActionRequest): boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
/** 当前默认允许发送,后续可在这里补充权限限制。 */
|
||||
export function checkEntitlement(request: WechatActionRequest): boolean {
|
||||
void request
|
||||
return true
|
||||
}
|
||||
|
||||
export function normalizeActionRequest(value: unknown): WechatActionRequest | null {
|
||||
if (!value || typeof value !== 'object') return null
|
||||
const input = value as Partial<WechatActionRequest>
|
||||
|
||||
Reference in New Issue
Block a user