An open API service indexing awesome lists of open source software.

https://github.com/isboyjc/wechaty-friend-pass

Wechat friend application passes automatically
https://github.com/isboyjc/wechaty-friend-pass

friend-pass wechaty wechaty-plugin

Last synced: about 1 year ago
JSON representation

Wechat friend application passes automatically

Awesome Lists containing this project

README

          

# wechaty-friend-pass

[![Wechaty Plugin Contrib](https://img.shields.io/badge/Wechaty%20Plugin-wechaty--friend--pass-brightgreen.svg)](https://github.com/isboyjc/wechaty-friend-pass) [![Powered by Wechaty](https://img.shields.io/badge/Powered%20By-Wechaty-brightgreen.svg)](https://github.com/Wechaty/wechaty)

Wechat friend application passes automatically

微信好友申请自动通过

## 开始

### 简介

你是否想要自己的微信机器人自动通过好友请求,或者设置一些关键字,通过好友申请时备注的关键字来校验是否要自动通过该好友申请,并且通过好友申请时自动回复一段话

如果是的话,那么你可以使用这个插件,虽然是一个很简单的功能但是使用 `plugin` 可以使我们的代码更简洁

到这里它的功能你应该了解了,那么我们来看看它如何使用

### 安装

```txt
npm install wechaty-friend-pass

or

yarn add wechaty-friend-pass
```

### 使用

```js
const WechatyFriendPass = require("wechaty-friend-pass")

bot.use(WechatyFriendPass(options))
```

如上所示

使用插件只要按需传入配置对象 `options` 即可

| Options 参数属性 | 类型 | 简介 |
| ---------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| keyword | String\|Array | 好友请求时备注自动通过的关键字,只有一个可以使用字符串类型,多个关键字使用数组类型,全部通过不用校验传入字符串 "\*" 即可,不传即都不自动通过 |
| blackId | String\|Array | 用户黑名单 ID,该项可填写用户的 ID 来识别用户,让此用户不被自动通过,也可不填 |
| reply | String | 自动通过用户好友申请后自动回复一句话,为空或不填则通过后不回复 |

### 示例

```js
const { Wechaty } = require("wechaty")
const { PuppetPadplus } = require("wechaty-puppet-padplus")
const Qrterminal = require("qrcode-terminal")
// 引入插件 WechatyFriendPass
const WechatyFriendPass = require("wechaty-friend-pass")

// 初始化 bot
const bot = new Wechaty({
puppet: new PuppetPadplus({
token: PUPPET_PADPLUS_TOKEN,
}),
name: ROBOT_NAME,
})

// 插件配置对象
const options = {
keyword: ["加群", "前端", "后端", "全栈"],
blackId: ["*******", "*******"],
reply:
"你好,我是机器人小助手圈子 \n 加入技术交流群请回复【加群】\n 联系小主请回复【123】",
}

// 使用插件
bot.use(WechatyFriendPass(options))

bot
.on("scan", (qrcode, status) => {
Qrterminal.generate(qrcode, { small: true })
})
.start()
```

### 最后

扫描二维码,加圈子微信,进交流群哦,效果如下图,赶快来试试吧

图片名称


图片名称
图片名称