Skip to content

Commit

Permalink
feat: 添加ipad协议支持
Browse files Browse the repository at this point in the history
  • Loading branch information
leochen-g committed Dec 20, 2022
1 parent 8efbb4f commit 18e3a1f
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 25 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## 更新日志
### V4.2.7(2022-12-20)

一、更新插件版本,增加ipad协议支持

### V4.2.5(2022-12-07)

Expand Down
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# ~~遗憾的通知~~

uos 协议又可以重新使用了
uos 协议又可以重新使用了,同时已经适配wechaty-puupet-padloacl的协议
~~由于UOS桌面版协议微信已经关闭了,没法再继续用桌面版协议登录了,现在只能换回web协议了。可以登录网页版微信的账号可以继续用,不能登录网页版协议的就不能用了。或者你可以申请Wechaty 的ipad local协议的token可以免费试用7天 。申请地址: https://github.com/padlocal/wechaty-puppet-padlocal~~

## 智能微秘书-插件版 (Wechaty 1.x版本)
Expand Down Expand Up @@ -201,7 +201,15 @@ docker run -e AIBOTK_KEY="微秘书apikey" -e AIBOTK_SECRET="微秘书apiSecret"

### 其他协议运行

Wechaty1.x版本暂不支持ipad协议,如需ipad协议运行,请移步:[https://github.com/leochen-g/wechat-assistant-pro-ipad](https://github.com/leochen-g/wechat-assistant-pro-ipad)
~~Wechaty1.x版本暂不支持ipad协议,如需ipad协议运行,请移步:[https://github.com/leochen-g/wechat-assistant-pro-ipad](https://github.com/leochen-g/wechat-assistant-pro-ipad)~~

如果你有ipad的token,可以执行以下命令

```shell

docker run -d -e PAD_LOCAL_TOKEN="你申请的ipadlocal token" -e AIBOTK_KEY="微秘书apikey" -e AIBOTK_SECRET="微秘书apiSecret" --name=wechatbot aibotk/wechat-assistant

```

## 体验与交流

Expand Down Expand Up @@ -237,7 +245,6 @@ Wechaty1.x版本暂不支持ipad协议,如需ipad协议运行,请移步:[h
![](./doc/img/index.png)
![](./doc/img/roomasync.png)
![](./doc/img/everyday.png)
![](./doc/img/schedule.png)
![](./doc/img/event.png)
![](./doc/img/material.png)

Expand All @@ -251,11 +258,11 @@ Wechaty1.x版本暂不支持ipad协议,如需ipad协议运行,请移步:[h

群消息同步

![](./doc/img/async.png)
<img src="./doc/img/async.png" width="300">

群合影

![](./doc/img/group.jpeg)
<img src="./doc/img/group.jpeg" width="300">



Expand Down
Binary file modified doc/img/event.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/img/everyday.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/img/index.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/img/material.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/img/roomasync.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wechat-assistant",
"version": "4.2.6",
"description": "微信小助手4.2.6",
"version": "4.2.7",
"description": "微信小助手4.2.7",
"main": "index.js",
"type": "module",
"scripts": {
Expand Down Expand Up @@ -30,6 +30,7 @@
"dependencies": {
"wechaty": "^1.20.2",
"wechaty-dice-king": "^1.0.16",
"wechaty-puppet-padlocal": "^1.20.1",
"wechaty-puppet-wechat": "^1.18.4",
"wechaty-web-panel": "^1.2.9"
},
Expand Down
1 change: 1 addition & 0 deletions pm2.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"name": "wechaty-pro",
"cwd": "./",
"script": "./index.js",
"cron_restart": "0 0 * * *",
"log_date_format": "YYYY-MM-DD HH:mm Z",
"error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log",
Expand Down
47 changes: 29 additions & 18 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
import { WechatyBuilder } from 'wechaty'
import { WechatyWebPanelPlugin } from 'wechaty-web-panel'
import {WechatyBuilder} from 'wechaty'
import {WechatyWebPanelPlugin} from 'wechaty-web-panel'

const name = 'wechat-assistant-pro';
let bot = '';
let padLocalToken = '' // 如果申请了ipadlocal的token,可以直接填入

if (process.env['PAD_LOCAL_TOKEN']) {
console.log('读取到环境变量中的ipadLocalToken')
padLocalToken = process.env['PAD_LOCAL_TOKEN']
}

console.log('默认使用uos web版微信协议')
bot = WechatyBuilder.build({
name, // generate xxxx.memory-card.json and save login data for the next login
puppetOptions: {
uos: true
},
puppet: 'wechaty-puppet-wechat',
});
if (padLocalToken) {
console.log('读取到环境变量中的ipad token 使用ipad协议启动')
bot = WechatyBuilder.build({
name, // generate xxxx.memory-card.json and save login data for the next login
puppetOptions: {
token: padLocalToken
}, puppet: 'wechaty-puppet-padlocal',
});

} else {
console.log('默认使用uos web协议启动')
bot = WechatyBuilder.build({
name, // generate xxxx.memory-card.json and save login data for the next login
puppetOptions: {
uos: true
}, puppet: 'wechaty-puppet-wechat',
});
}

bot.use(
WechatyWebPanelPlugin({
apiKey: '***',
apiSecret: '****',
})
)
bot.start()
.catch((e) => console.error(e));

bot.use(WechatyWebPanelPlugin({
apiKey: '***', apiSecret: '****',
}))
bot.start()
.catch((e) => console.error(e));

0 comments on commit 18e3a1f

Please sign in to comment.