From a1a0453f2a496362497f54d5c088fe1a0fdbe558 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 17 Nov 2024 16:31:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=8F=92=E4=BB=B6=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- src/index.js | 4 +++- src/matrix.js | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index eb48776..9bac584 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wechat-assistant", - "version": "5.0.11", + "version": "5.0.12", "description": "智能微秘书,一个全能的微信机器人管理平台,最简单的方式接入 ChatGPT,FastGPT,Dify,Coze知识库,支持绘图,联网查询,语音识别,各种定时任务,支持企微、个微、公众号、5G 消息、WhatsApp", "main": "index.js", "type": "module", @@ -46,7 +46,7 @@ "@juzi/wechaty": "^1.0.100", "@juzi/wechaty-puppet": "^1.0.91", "@juzi/wechaty-puppet-service": "^1.0.100", - "wechaty-web-panel": "^1.6.66" + "wechaty-web-panel": "^1.6.67" }, "devDependencies": { "pm2": "^4.2.3" diff --git a/src/index.js b/src/index.js index 878335e..245874e 100644 --- a/src/index.js +++ b/src/index.js @@ -8,6 +8,7 @@ import {startMatrix} from "./matrix.js"; let bot = ''; let padLocalToken = '' // 如果申请了ipadlocal的token,可以直接填入 let matrixToken = '' // 如果申请了matrix的token,可以直接填入 +let matrixBridgeId = '' // 代理id let workProToken = '' // 如果申请了企业微信的token 可以直接填入 // 公众号相关配置 @@ -25,6 +26,7 @@ if (process.env['PAD_LOCAL_TOKEN']) { if (process.env['MATRIX_TOKEN']) { console.log('读取到环境变量中的ipad matrix token') matrixToken = process.env['MATRIX_TOKEN'] + matrixBridgeId = process.env['MATRIX_BRIDGE_ID'] } if (process.env['WORK_PRO_TOKEN']) { @@ -52,7 +54,7 @@ if (officeAppId) { } else if (padLocalToken) { bot = startPadlocal(padLocalToken) } else if (matrixToken) { - bot = startMatrix(matrixToken) + bot = startMatrix(matrixToken, matrixBridgeId) } else if(workProToken) { bot = startWorkpro(workProToken) } else { diff --git a/src/matrix.js b/src/matrix.js index b63cfa9..4da5b77 100644 --- a/src/matrix.js +++ b/src/matrix.js @@ -2,14 +2,15 @@ import {WechatyBuilder} from '@juzi/wechaty' import {PuppetMatrix} from 'wechaty-puppet-matrix' -export function startMatrix(matrixToken) { +export function startMatrix(matrixToken, matrixBridgeId) { const name = 'wechat-assistant-matrix-pad'; let bot = ''; console.log('读取到环境变量中的matrix ipad token 使用ipad协议启动') bot = WechatyBuilder.build({ name, puppet: new PuppetMatrix({ - token: matrixToken + token: matrixToken, + proxyId: matrixBridgeId || '' }), }); return bot