mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-10-11 03:11:38 +08:00
feat: mac发送能力重构为libtmwechat
- 发送改走本地host, 在微信登录时触发 - 删除旧OneBot及对应UI控制面
This commit is contained in:
@@ -30,9 +30,22 @@ const AUTOMATION_PURPOSE_ALLOWLIST = new Set([
|
||||
// `AUTOMATION_SEND_PURPOSE` 保持一致,否则会被下面 evaluateWechatActionPolicy
|
||||
// 以 ACTION_NOT_ALLOWED 拦下 —— 那是有意的闸门,不是 bug。
|
||||
'automation_reply',
|
||||
'automation_report'
|
||||
'automation_report',
|
||||
'manual_report_image',
|
||||
'manual_report_postfix'
|
||||
])
|
||||
|
||||
export interface ReportImageSequenceRequest {
|
||||
recipient: WechatActionRequest['recipient']
|
||||
imagePath: string
|
||||
postfixText: string
|
||||
}
|
||||
|
||||
export interface ReportImageSequenceResult {
|
||||
image: WechatActionResult
|
||||
postfix?: WechatActionResult
|
||||
}
|
||||
|
||||
export interface WechatActionGatewayDependencies {
|
||||
getCapability?: () => Promise<PersonalWechatSendCapability>
|
||||
send?: (request: PersonalWechatSendRequest) => Promise<PersonalWechatSendResult>
|
||||
@@ -111,6 +124,35 @@ export class WechatActionGateway {
|
||||
this.memberEvents.clear()
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户确认后的日报发送序列。两步都进入 automation 发送队列,从而复用既有 3 秒间隔;
|
||||
* 后置词 action 只在图片明确 sent 后创建,图片失败/blocked 时严格短路。
|
||||
*/
|
||||
async executeReportImageSequence(
|
||||
request: ReportImageSequenceRequest
|
||||
): Promise<ReportImageSequenceResult> {
|
||||
const image = await this.execute({
|
||||
origin: 'user_manual',
|
||||
purpose: 'manual_report_image',
|
||||
triggerType: 'automation',
|
||||
recipient: request.recipient,
|
||||
content: { type: 'image', path: String(request.imagePath || '') }
|
||||
})
|
||||
if (image.status !== 'sent') return { image }
|
||||
|
||||
const postfixText = String(request.postfixText || '').trim()
|
||||
if (!postfixText) return { image }
|
||||
|
||||
const postfix = await this.execute({
|
||||
origin: 'user_manual',
|
||||
purpose: 'manual_report_postfix',
|
||||
triggerType: 'automation',
|
||||
recipient: request.recipient,
|
||||
content: { type: 'text', text: postfixText }
|
||||
})
|
||||
return { image, postfix }
|
||||
}
|
||||
|
||||
listAuditRecords(): WechatActionAuditRecord[] {
|
||||
return this.loadAuditState().records.map((record) => ({ ...record }))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user