添加完整的微信插件测试框架,包含: - 微信插件源码(weixin-plugin/) - TypeScript 类型定义(types.ts) - 插件编译脚本(scripts/build-weixin-plugin.sh) - 简化测试脚本(scripts/test-weixin-simple.js) - 完整测试脚本(scripts/test-weixin-plugin.js) - 项目配置和依赖管理(package.json) - 使用说明文档(README.md) 主要功能: - 支持二维码登录认证 - HTTP 长轮询消息接收 - 文本、图片、视频、文件消息收发 - 自动回复测试 - 运行状态统计 Generated with [Claude Code](https://claude.com/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
65 lines
1.4 KiB
TypeScript
65 lines
1.4 KiB
TypeScript
/**
|
|
* Weixin Plugin Type Definitions
|
|
* Types for Weixin personal account integration
|
|
*/
|
|
|
|
// ==================== Weixin Types ====================
|
|
|
|
export interface WeixinConfig {
|
|
enabled: boolean;
|
|
debug?: boolean;
|
|
}
|
|
|
|
export interface WeixinGatewayStatus {
|
|
connected: boolean;
|
|
startedAt: number | null;
|
|
lastError: string | null;
|
|
accountId: string | null;
|
|
lastInboundAt: number | null;
|
|
lastOutboundAt: number | null;
|
|
}
|
|
|
|
// ==================== Common IM Types (reused from main project) ====================
|
|
|
|
export interface IMMessage {
|
|
platform: string;
|
|
messageId: string;
|
|
conversationId: string;
|
|
senderId: string;
|
|
senderName?: string;
|
|
groupName?: string;
|
|
content: string;
|
|
chatType: 'direct' | 'group';
|
|
chatSubType?: string;
|
|
timestamp: number;
|
|
attachments?: IMMediaAttachment[];
|
|
mediaGroupId?: string;
|
|
}
|
|
|
|
export interface IMMediaAttachment {
|
|
type: 'image' | 'video' | 'audio' | 'voice' | 'document' | 'sticker';
|
|
localPath: string;
|
|
mimeType: string;
|
|
fileName?: string;
|
|
fileSize?: number;
|
|
width?: number;
|
|
height?: number;
|
|
duration?: number;
|
|
}
|
|
|
|
// ==================== Default Values ====================
|
|
|
|
export const DEFAULT_WEIXIN_CONFIG: WeixinConfig = {
|
|
enabled: false,
|
|
debug: true,
|
|
};
|
|
|
|
export const DEFAULT_WEIXIN_STATUS: WeixinGatewayStatus = {
|
|
connected: false,
|
|
startedAt: null,
|
|
lastError: null,
|
|
accountId: null,
|
|
lastInboundAt: null,
|
|
lastOutboundAt: null,
|
|
};
|