Skip to content

Commit 4f228fd

Browse files
authored
Update paimon.md (wechaty#1472)
* Update paimon.md * Update paimon.md * Update paimon.md * Update paimon.md * Update paimon.md * upgrade wechaty to 1.x
1 parent 3a1f7d3 commit 4f228fd

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

docusaurus/docs/puppet-services/paimon.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,100 @@ sidebar_label: Paimon
1111
- Privacy Policy: To-be-added
1212
- Service Level Agreement (SLA): To-be-added
1313

14+
## Simple and Effective
15+
16+
- Paimon service is so simple.It don't need Token Gateway(Docker) and don't need the 3rd party library.
17+
- Paimon的服务很简单,不需要token网关也不需要第三方的库,原生支持Wechaty。
18+
19+
package.json
20+
21+
```json
22+
{
23+
"name": "wechaty-puppet-paimon",
24+
"version": "0.0.1",
25+
"description": "Demo for paimon",
26+
"author": "you",
27+
"license": "Apache-2.0",
28+
"dependencies": {
29+
"qrcode-terminal": "^0.12.0",
30+
"wechaty": "^1.0"
31+
}
32+
}
33+
34+
```
35+
36+
bot.js
37+
38+
```js
39+
const {
40+
log,
41+
ScanStatus,
42+
WechatyBuilder,
43+
} = require('wechaty')
44+
45+
const bot = WechatyBuilder.build({
46+
name: 'ding-dong-bot',
47+
puppet: 'wechaty-puppet-service',
48+
puppetOptions: {
49+
tls: {
50+
disable: true
51+
},
52+
token: "puppet_paimon_YOUR_TOKEN" // !!!!! Please change it !!!!!
53+
}
54+
})
55+
56+
function onScan(qrcode, status) {
57+
if (status === ScanStatus.Waiting && qrcode) {
58+
const qrcodeImageUrl = [
59+
'https://wechaty.js.org/qrcode/',
60+
encodeURIComponent(qrcode),
61+
].join('')
62+
63+
log.info('StarterBot', 'onScan: %s(%s) - %s', ScanStatus[status], status, qrcodeImageUrl)
64+
} else {
65+
log.info('StarterBot', 'onScan: %s(%s)', ScanStatus[status], status)
66+
}
67+
}
68+
69+
function onLogin(user) {
70+
log.info('StarterBot', '%s login', user);
71+
}
72+
73+
function onLogout(user) {
74+
log.info('StarterBot', '%s logout', user);
75+
}
76+
77+
function onMessage(msg) {
78+
console.log(msg)
79+
if (msg.self()) return;
80+
}
81+
82+
bot.on('scan', onScan)
83+
bot.on('login', onLogin)
84+
bot.on('logout', onLogout)
85+
bot.on('message', onMessage)
86+
87+
bot.start()
88+
.then(() => {
89+
log.info('StarterBot', 'Starter Bot Started.');
90+
})
91+
.catch(e => {
92+
log.error('StarterBot', e);
93+
})
94+
```
95+
96+
```bash
97+
>> npm i
98+
>> node bot.js
99+
```
100+
101+
## Paimon supports multi languages
102+
103+
NO token gateway required.(不需要Token网关直接使用)
104+
105+
- [Python](https://wechaty.readthedocs.io/zh_CN/latest/introduction/use-paimon-protocol/)
106+
- [GO](https://github.com/wechaty/go-wechaty-getting-started)
107+
14108
## How to buy
15109

16110
[Get a FREE trail token for 7 days.](http://120.55.60.194/)

0 commit comments

Comments
 (0)