Skip to content

Commit 411145f

Browse files
committed
updated readme
1 parent 5170175 commit 411145f

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

demo.jpeg

-95.4 KB
Binary file not shown.

gtp3.jpg

-264 KB
Binary file not shown.

qr.jpeg

-44.3 KB
Binary file not shown.

readme.md

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
33
## Wechaty Log Monitor
44

5-
This is a Wechaty plugin for log-related DevOps. Fully functional! Very Loose coupling! Pretty much pure (other than side effects in I.O.)!
5+
This is a Wechaty plugin for log-related DevOps. Fully functional! Very Loose coupling! Pretty much pure (other than side effects in I.O.)! It allows you to receive log alerts, view log files, execute cmd, and perform DevOps such as _QR Rescue_ for your WeChaty on Wechat itself!
66

7-
It allows you to receive log alerts, view log files, execute command lines, and do devops like "QR Rescue" for your WeChaty on WeChat!
7+
![demo](images/demo2.jpeg)
88

9-
![demo](demo.jpeg)
9+
[A Chinese write-up about this plugin is published on wechaty.js.org](https://wechaty.js.org/2020/08/09/wechaty-log-monitor/).
1010

11-
## Quick guide to implement your log operation:
11+
## Quick guide to implementing your Wechaty log operation:
1212

1313
```typescript
1414
import { Wechaty, FileBox } from 'wechaty'
@@ -46,17 +46,13 @@ For examples see `src/qrRescue.ts` and `src/miscellaneous.ts`!
4646
yarn add wechaty-log-monitor@latest
4747
```
4848

49-
### 一、掉线给码(QR Rescue)
50-
51-
一个Wechaty掉线了,另一个Wechaty会发QR码给这个微信号来重新登陆~
52-
53-
这样掉线了就不用`ssh`到production服务器,然后`sudo su git`+`pm2 logs --lines 50`来进行扫码重登了。
49+
### 1. qrResuce (aka 掉线给码)
5450

5551
Requirements:
5652

57-
- 至少两个Wechaty bots(要部署到同个server)。
53+
- At least two Wechaties. Must be deployed on the same production server.
5854

59-
- 登陆的话因为要用到微信「扫一扫」功能,需要两部手机,或一个手机+把qr投影到一个屏幕上
55+
- Two phones. Or a way to project the QR code onto a screen so you can scan it in your Wechat via the native camera.
6056

6157
```typescript
6258
import {qrResuce, WechatyLogMonitor} from "wechaty-log-monitor"
@@ -74,13 +70,10 @@ bot.use(
7470
)
7571
```
7672

77-
### 二、发log给你
78-
79-
每当指定的log file有新的一行,bot就会发送给adminWeixin。默认一分钟最多发3条,`maxLogPerMinute`可改为任何数值。
73+
![demo](images/demo.jpeg)
8074

81-
<!-- 每当指定的log file有新的一行,bot就会发送给adminWeixin。默认一分钟最多发3条,一个小时最多发30条,`maxLogPerMinute`和`maxLogPerHour`可改为任何数值。 -->
8275

83-
除此之外,如果adminWeixin发给bot「log `customName`」, bot会把整个log发给adminWeixin。
76+
### 二、logAlert (aka 发log给你)
8477

8578
```typescript
8679
import {logAlert, WechatyLogMonitor} from "wechaty-log-monitor"
@@ -96,9 +89,8 @@ bot.use(
9689
)
9790
```
9891

99-
### 三、重启 pm2
92+
### 三、restartPM2 (aka PM2重启)
10093

101-
adminWeixin发`restart`给bot,bot就会重启函数中指定的pm2.
10294

10395
```typescript
10496
import {restartPM2, WechatyLogMonitor} from "wechaty-log-monitor"
@@ -113,12 +105,16 @@ bot.use(
113105
)
114106
```
115107

108+
![demo](images/restart.jpeg)
109+
116110
Please feel free to fork me & implement more features! Pull requests are welcomed too!
117111

118112
## To-do
119113

120114
0. write integration test cases using wechaty-mock
121115

122-
1. add authentication support for dangerous commands (using SMS, authy, googleAuth)
116+
1. add authentication support (via SMS, authy, googleAuth)
123117

124118
2. integrate [GPT-3 Natural language Shell](https://beta.openai.com/?app=productivity&example=4_2_0)
119+
120+
![demo](images/gtp3.jpeg)

0 commit comments

Comments
 (0)