openclaw-github-trending 1.4.1 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -375,15 +375,29 @@ The plugin supports OpenAI-compatible API providers. If not configured in the pl
375
375
 
376
376
  | Field | Type | Required | Default | Description |
377
377
  |-------|------|----------|---------|-------------|
378
- | `enabled` | boolean | No | `false` | Enable WeChat notifications via @tencent-weixin/openclaw-weixin plugin |
379
- | `receiver_id` | string | No | - | WeChat receiver ID (format: `xxx@im.wechat`) |
378
+ | `enabled` | boolean | No | `true` | Enable WeChat notifications via @tencent-weixin/openclaw-weixin plugin |
379
+ | `receiver_id` | string | No | Auto-detect | WeChat receiver ID (format: `xxx@im.wechat`) |
380
380
  | `bot_account_id` | string | No | - | WeChat bot account ID (format: `xxx-im-bot`) |
381
381
 
382
+ **receiver_id Auto-Detection:**
383
+
384
+ The plugin will automatically detect `receiver_id` using the following priority (no manual configuration needed in most cases):
385
+
386
+ 1. **Plugin Config**: `plugins.openclaw-github-trending.config.channels.wechat.receiver_id`
387
+ 2. **Environment Variable**: `OPENCLAW_WECHAT_RECEIVER_ID`
388
+ 3. **Message Context**: If current session is from WeChat, auto-reply to sender
389
+ 4. **Session History**: Extract from `~/.openclaw/agents/main/sessions/sessions.json`
390
+ 5. **OpenClaw Config**: Search WeChat plugin configuration and sessions
391
+
392
+ **⚠️ Important:**
393
+ - WeChat ID is **case-sensitive**, e.g., `o9cq806Il_QmHA022BUNXe0hUv4I@im.wechat`
394
+ - If auto-detection fails, detailed configuration guide will be shown
395
+
382
396
  **WeChat Requirements:**
383
397
 
384
398
  1. **Install WeChat Plugin**:
385
399
  ```bash
386
- npm install @tencent-weixin/openclaw-weixin
400
+ openclaw plugins install @tencent-weixin/openclaw-weixin
387
401
  ```
388
402
 
389
403
  2. **Configure in OpenClaw** (`~/.openclaw/openclaw.json`):
@@ -391,20 +405,25 @@ The plugin supports OpenAI-compatible API providers. If not configured in the pl
391
405
  {
392
406
  "plugins": {
393
407
  "entries": {
394
- "@tencent-weixin/openclaw-weixin": {
395
- "enabled": true,
396
- "config": {
397
- "enable_login": true
398
- }
399
- },
408
+ "openclaw-weixin": {
409
+ "enabled": true
410
+ }
411
+ }
412
+ }
413
+ }
414
+ ```
415
+
416
+ 3. **Optional: Configure receiver_id** (only if you need to push to a specific user):
417
+ ```json
418
+ {
419
+ "plugins": {
420
+ "entries": {
400
421
  "openclaw-github-trending": {
401
- "enabled": true,
402
422
  "config": {
403
423
  "channels": {
404
424
  "wechat": {
405
425
  "enabled": true,
406
- "receiver_id": "xxx@im.wechat",
407
- "bot_account_id": "xxx-im-bot"
426
+ "receiver_id": "o9cq806Il_QmHA022BUNXe0hUv4I@im.wechat"
408
427
  }
409
428
  }
410
429
  }
@@ -414,38 +433,24 @@ The plugin supports OpenAI-compatible API providers. If not configured in the pl
414
433
  }
415
434
  ```
416
435
 
417
- 3. **Configuration Options (choose one)**:
418
- - **Config File (Recommended)**: Set `receiver_id` and `bot_account_id` in the `wechat` section of `openclaw.json`
419
- - **Environment Variables**: Set `OPENCLAW_WECHAT_RECEIVER_ID` and `OPENCLAW_WECHAT_BOT_ACCOUNT_ID`
420
- - **Default Values**: Use built-in default configuration (for testing only)
436
+ **💡 Tip**: If `receiver_id` is not configured, the plugin will auto-detect it from session history.
421
437
 
422
- 4. **Login to WeChat**:
423
- - OpenClaw will prompt you to scan QR code with your personal WeChat
424
- - After login, messages will be sent to the configured WeChat account
438
+ **🔍 How to Get Your WeChat ID:**
425
439
 
426
- 5. **Usage**:
427
- **⚠️ Important: WeChat notifications are only supported in OpenClaw chat context, not in CLI mode (`openclaw gen-cron` command)**
440
+ ```bash
441
+ # Method 1: Check OpenClaw session history
442
+ cat ~/.openclaw/agents/main/sessions/sessions.json | jq 'to_entries[] | select(.key | contains("wechat")) | {key, lastTo}'
428
443
 
429
- **Use in OpenClaw Chat** (Recommended):
430
- ```text
431
- Use openclaw-github-trending tool to get today's trending and push to WeChat
432
- or
433
- Run immediately: Fetch today's trending and push to WeChat
434
- ```
444
+ # Method 2: Check message send records
445
+ cat ~/.openclaw/agents/main/sessions/sessions.json | grep -i "o9cq.*@im.wechat"
435
446
 
436
- **Create scheduled task in chat**:
437
- ```bash
438
- openclaw cron add --name "GitHub Trending Daily WeChat" \
439
- --cron "0 18 * * *" \
440
- --system-event '{"tool":"openclaw-github-trending","params":{"since":"daily","channels":["wechat"]}}'
441
- ```
447
+ # Method 3: Send a test message and check logs
448
+ openclaw message send --channel openclaw-weixin --target "your-wechat-id" "test"
449
+ ```
442
450
 
443
- **Notes:**
444
- - WeChat notifications are sent as markdown messages to your personal WeChat account
445
- - Messages include new repositories (with full AI summaries) and trending repositories (with brief summaries)
446
- - WeChat functionality depends on the `executeTool` API provided by @tencent-weixin/openclaw-weixin plugin
447
- - CLI mode will return an error when using WeChat channel
448
- - If the WeChat plugin is not installed or configured, the plugin will show a warning but continue with other channels
451
+ **⚠️ Notes:**
452
+ - WeChat ID format: `o9cq806Il_QmHA022BUNXe0hUv4I@im.wechat` (case-sensitive!)
453
+ - If auto-detection fails, error message includes detailed configuration guide
449
454
 
450
455
  *Required when using this channel
451
456
 
@@ -1,51 +1,43 @@
1
1
  import { RepositoryInfo } from '../models/repository';
2
2
  import { PushResult } from './types';
3
3
  /**
4
- * WeChat channel configuration interface
4
+ * WeChat channel configuration
5
5
  */
6
6
  export interface WeChatConfig {
7
- plugin_enabled?: boolean;
7
+ enabled?: boolean;
8
8
  receiver_id?: string;
9
9
  bot_account_id?: string;
10
+ channel_name?: string;
10
11
  }
11
12
  /**
12
- * WeChat Channel for pushing GitHub trending repositories via personal WeChat
13
- * Uses the @tencent-weixin/openclaw-weixin plugin
13
+ * WeChat Channel - 通过企业微信推送 GitHub 热榜
14
14
  */
15
15
  export declare class WeChatChannel {
16
16
  /**
17
- * Build markdown message for WeChat
18
- * @param newRepositories Array of new repositories
19
- * @param seenRepositories Array of seen repositories
20
- * @param since Time period for trending
21
- * @returns Markdown formatted message
17
+ * 构建纯文本消息(企业微信不支持 markdown
22
18
  */
23
- static buildMarkdown(newRepositories: RepositoryInfo[], seenRepositories: RepositoryInfo[], since?: 'daily' | 'weekly' | 'monthly'): string;
19
+ static buildPlainText(newRepositories: RepositoryInfo[], seenRepositories: RepositoryInfo[], since?: 'daily' | 'weekly' | 'monthly'): string;
24
20
  /**
25
- * Format number with 'k' suffix for thousands
26
- * @param num Number to format
27
- * @returns Formatted string
21
+ * 文本自动换行
22
+ */
23
+ static wrapText(text: string, maxWidth?: number): string[];
24
+ /**
25
+ * 格式化数字(添加 k 后缀)
28
26
  */
29
27
  static formatNumberWithK(num: number): string;
30
28
  /**
31
- * Send message via OpenClaw WeChat plugin
32
- * The plugin should be installed and configured in OpenClaw
33
- *
34
- * @param markdownContent Markdown content to send
35
- * @param openclawApi OpenClaw API instance for invoking channels
36
- * @param config WeChat configuration
37
- * @returns Push result
29
+ * 发送消息到微信(通过 openclaw CLI)
30
+ */
31
+ static send(content: string, openclawApi: any, config: WeChatConfig): Promise<PushResult>;
32
+ /**
33
+ * 从多个来源解析 receiver_id
34
+ * 优先级:1. 插件配置 2. 环境变量 3. 消息上下文 4. 会话历史 5. OpenClaw API
38
35
  */
39
- static send(markdownContent: string, openclawApi: any, config: WeChatConfig): Promise<PushResult>;
36
+ private static resolveReceiverId;
40
37
  /**
41
- * Alternative method: Use OpenClaw's chat interface to send message
42
- * This sends the message as if the plugin itself is "chatting" to the user
43
- *
44
- * @param markdownContent Markdown content to send
45
- * @param openclawApi OpenClaw API instance
46
- * @returns Push result
38
+ * 通过 openclaw CLI 发送消息
47
39
  */
48
- static sendViaChat(markdownContent: string, openclawApi: any): Promise<PushResult>;
40
+ private static sendViaCli;
49
41
  }
50
42
  export default WeChatChannel;
51
43
  //# sourceMappingURL=wechat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wechat.d.ts","sourceRoot":"","sources":["../../src/channels/wechat.ts"],"names":[],"mappings":"AACA,O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