# wechaty-puppet-padplus

> Puppet Padplus for Wechaty

Latest version **0.6.6** (published 2020-09-02) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install wechaty-puppet-padplus
pnpm add wechaty-puppet-padplus
yarn add wechaty-puppet-padplus
bun add wechaty-puppet-padplus
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.6 |
| Published | 2020-09-02 |
| First published | 2019-09-09 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 17 |
| Unpacked size | 1.4 MB |
| Known vulnerabilities | 0 (+27 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 338 |
| Author | G.CH. S.C. |
| Maintainers | suchang |
| Keywords | chatie, wechaty, chatbot, bot, wechat, sdk, puppet, padplus |

## Links

- npm: https://www.npmjs.com/package/wechaty-puppet-padplus
- Repository: https://github.com/botorange/wechaty-puppet-padplus
- Homepage: https://github.com/botorange/wechaty-puppet-padplus#readme
- Issues: https://github.com/botorange/wechaty-puppet-padplus/issues
- npm.io page: https://npm.io/package/wechaty-puppet-padplus

## Dependencies (17)

- [grpc](https://npm.io/package/grpc.md) ^1.22.0
- [uuid](https://npm.io/package/uuid.md) ^7.0.0
- [axios](https://npm.io/package/axios.md) ^0.19.2
- [brolog](https://npm.io/package/brolog.md) ^1.6.5
- [xml2js](https://npm.io/package/xml2js.md) ^0.4.22
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [rx-queue](https://npm.io/package/rx-queue.md) ^0.8.5
- [watchdog](https://npm.io/package/watchdog.md) ^0.8.10
- [lru-cache](https://npm.io/package/lru-cache.md) ^5.1.1
- [flash-store](https://npm.io/package/flash-store.md) ^0.14.5
- [ffmpeg-probe](https://npm.io/package/ffmpeg-probe.md) ^1.0.6
- [state-switch](https://npm.io/package/state-switch.md) ^0.9.7
- [array-flatten](https://npm.io/package/array-flatten.md) ^3.0.0
- [promise-retry](https://npm.io/package/promise-retry.md) ^1.1.1
- [google-protobuf](https://npm.io/package/google-protobuf.md) ^3.6.1
- [wechaty-puppet-cache](https://npm.io/package/wechaty-puppet-cache.md) ^0.1.10
- [ffmpeg-extract-frames](https://npm.io/package/ffmpeg-extract-frames.md) ^2.0.2

## Alternatives

- [@snazzah/davey](https://npm.io/package/@snazzah/davey.md) — 1.5M weekly downloads
- [@vendure/testing](https://npm.io/package/@vendure/testing.md) — 8.3K weekly downloads
- [vue-simple-context-menu](https://npm.io/package/vue-simple-context-menu.md) — 6.6K weekly downloads
- [cypress-webpack-preprocessor-v5](https://npm.io/package/cypress-webpack-preprocessor-v5.md) — 2.1K weekly downloads
- [@backstage/plugin-catalog-backend-module-puppetdb](https://npm.io/package/@backstage/plugin-catalog-backend-module-puppetdb.md) — 1.3K weekly downloads

## Recent versions

- 0.6.6 (latest) — 2020-09-02
- 0.7.43 (next) — 2020-11-10
- 0.7.42 — 2020-10-29
- 0.7.41 — 2020-10-14
- 0.7.40 — 2020-09-02
- 0.7.39 — 2020-08-24
- 0.6.5 — 2020-08-19
- 0.7.37 — 2020-08-19
- 0.6.4 — 2020-08-14
- 0.7.36 — 2020-08-10
- 0.7.35 — 2020-08-10
- 0.7.34 — 2020-08-02
- 0.7.33 — 2020-07-29
- 0.7.32 — 2020-07-28
- 0.7.31 — 2020-07-28
- … 196 more at https://npm.io/package/wechaty-puppet-padplus/versions

## README

# WECHATY-PUPPET-PADPLUS

[![Powered by Wechaty](https://img.shields.io/badge/Powered%20By-Wechaty-blue.svg)](https://github.com/chatie/wechaty)
[![NPM Version](https://badge.fury.io/js/wechaty-puppet-padplus.svg)](https://www.npmjs.com/package/wechaty-puppet-padplus)
[![npm (tag)](https://img.shields.io/npm/v/wechaty-puppet-padplus/next.svg)](https://www.npmjs.com/package/wechaty-puppet-padplus?activeTab=versions)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-blue.svg)](https://www.typescriptlang.org/)
[![Linux/Mac Build Status](https://travis-ci.com/wechaty/wechaty-puppet-padplus.svg?branch=master)](https://travis-ci.com/wechaty/wechaty-puppet-padplus) 

## Notice

Our Mission: Make it easy to build a WeChat Chatbot for developers.

We provide a **free** token for the developers who have a strong will and ability to build a valuable chatbot for users.

See more: [Token Support](https://github.com/juzibot/Welcome/wiki/Support-Developers), [Everything about wechaty](https://github.com/juzibot/Welcome/wiki/Everything-about-Wechaty)

## Install

### 1. Init

#### 1.1. Check your `Node` version first

```shell
node --version // v10.16.0
```

> for windows system

To make sure you could install `wechaty-puppet-padplus` successfully, you have to start PowerShell as Administrator and run these commands:

```shell
npm install -g windows-build-tools

npm install -g node-gyp
```

#### 1.2. Create your bot folder and do some init config

```shell
mkdir my-padplus-bot && cd my-padplus-bot

npm init -y

npm install ts-node typescript -g

tsc --init --target ES6

touch bot.ts // copy the example code to it
```

### 2. Install Wechaty Dependencies

```shell
npm install wechaty@latest

npm install wechaty-puppet-padplus@latest
```

Or some new features developing version:

```shell
npm install wechaty@next

npm install wechaty-puppet-padplus@next
```

### 3. Install Other Dependencies

> There's no need to install `wechaty-puppet` in my-padplus-bot

```shell
npm install qrcode-terminal
...
```

### 4. Run

> If you want to see detail logs about your bot, just run:

```shell
BROLOG_LEVEL=silly ts-node bot.ts
```

or

```shell
BROLOG_LEVEL=silly node bot.js
```


### 5. Cache Option

> wechaty-puppet-padplus use flash-store or mongo as cache store

- flash-store[default]
- mongo

> If you want to use mongo as cache sotre, just set the cacheOption, like this:

```ts
const puppet: Puppet = new PuppetPadplus({
  token,
  cacheOption: {
    type: 'mongo',
    url: 'mongodb://127.0.0.1:27017/testdb',
  },
})

```

#### Caution

*When you use mongo as cache store, wechaty-puppet-cache use some tables which have `wechaty-cache` prefix. [detail>>](https://www.npmjs.com/package/wechaty-puppet-cache#4-caution)*

### 6. Other Tips

> Set environment in windows

```shell
$Env:BROLOG_LEVEL='silly'
ts-node bot.ts
```

> If step 1~3 can not help you install successfully, please try this suggestion, otherwise just skip it please.

```shell
rm -rf node_modules package-lock.json
npm install
```

## Example

```ts
// bot.ts
import { Contact, Message, Wechaty } from 'wechaty'
import { ScanStatus } from 'wechaty-puppet'
import { PuppetPadplus } from 'wechaty-puppet-padplus'
import QrcodeTerminal from 'qrcode-terminal'

const token = 'your-token'

const puppet = new PuppetPadplus({
  token,
})

const name  = 'your-bot-name'

const bot = new Wechaty({
  puppet,
  name, // generate xxxx.memory-card.json and save login data for the next login
})

bot
  .on('scan', (qrcode, status) => {
    if (status === ScanStatus.Waiting) {
      QrcodeTerminal.generate(qrcode, {
        small: true
      })
    }
  })
  .on('login', (user: Contact) => {
    console.log(`login success, user: ${user}`)
  })
  .on('message', (msg: Message) => {
    console.log(`msg : ${msg}`)
  })
  .on('logout', (user: Contact, reason: string) => {
    console.log(`logout user: ${user}, reason : ${reason}`)
  })
  .start()
```

## How to emit the message that you sent

Please use environment variable `PADPLUS_REPLAY_MESSAGE` to activate this function.

```shell
PADPLUS_REPLAY_MESSAGE=true node bot.js
```

## Puppet Comparison

功能 | padpro | padplus | macpro
---|---|---|---
 **<消息>**|  |  |
 收发文本| ✅ |✅ |✅
 收发个人名片| ✅ |✅ |✅
 收发图文链接| ✅ |✅ |✅
 发送图片、文件| ✅ | ✅（对内容有大小限制，20M以下） |✅
 接收图片、文件| ✅ | ✅（对内容有大小限制，25M以下） |✅
 发送视频| ✅ | ✅ | ✅
 接收视频| ✅ | ✅ | ✅
 发送小程序| ❌ | ✅ | ✅
 接收动图| ❌ | ✅ | ✅
 发送动图| ❌ | ✅ | ✅
 接收语音消息| ✅ | ✅ | ✅
 发送语音消息| ✅ | ❌ | ❌
 转发文本| ✅ | ✅ | ✅
 转发图片| ✅ | ✅ | ✅
 转发图文链接| ✅ | ✅ | ✅
 转发音频| ✅ | ❌ | ✅
 转发视频| ✅ | ✅ | ✅
 转发文件| ✅ | ✅ | ✅
 转发动图| ❌ | ❌ | ❌
 转发小程序| ❌ | ✅ | ❌
 **<群组>**|  |  |
 创建群聊|✅|✅|✅
 设置群公告|✅|✅|✅
 获取群公告|❌|✅|❌
 群二维码|✅|✅|✅
 拉人进群|✅|✅|✅
 踢人出群|✅|✅|✅
 退出群聊|✅|✅|✅
 改群名称|✅|✅|✅
 入群事件|✅|✅|✅
 离群事件|✅|✅|✅
 群名称变更事件|✅|✅|✅
 @群成员|✅|✅|✅
 群列表|✅|✅|✅
 群成员列表|✅|✅|✅
 群详情|✅|✅|✅
 **<联系人>**|  |  |
 修改备注|✅|✅|✅
 添加好友|✅|✅|✅
 自动通过好友|✅|✅|❌
 添加好友|✅|✅|✅
 好友列表|✅|✅|✅
 好友详情|✅|✅|✅
 **<其他>**|  |  |
 登录微信|✅|✅|✅
 扫码状态|✅|✅|❌
 退出微信|✅|✅|✅
 依赖协议|iPad|iPad|Mac|

---
_Source: https://npm.io/package/wechaty-puppet-padplus · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
