Giter Site home page Giter Site logo

wechaty-puppet-padplus's Introduction

WECHATY-PUPPET-PADPLUS

Powered by Wechaty NPM Version npm (tag) TypeScript Linux/Mac Build Status

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, Everything about wechaty

Install

1. Init

1.1. Check your Node version first

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:

npm install -g windows-build-tools

npm install -g node-gyp

1.2. Create your bot folder and do some init config

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

npm install wechaty@latest

npm install wechaty-puppet-padplus@latest

Or some new features developing version:

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

npm install qrcode-terminal
...

4. Run

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

BROLOG_LEVEL=silly ts-node bot.ts

or

BROLOG_LEVEL=silly node bot.js

5. Other Tips

Set environment in windows

$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.

rm -rf node_modules package-lock.json
npm install

Example

// 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.

PADPLUS_REPLAY_MESSAGE=true node bot.js

Puppet Comparison

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

wechaty-puppet-padplus's People

Contributors

su-chang avatar windmemory avatar iguxiaobei avatar lijiarui avatar huan avatar greenkeeper[bot] avatar silentqianyi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.