Giter Site home page Giter Site logo

wechaty-robot's Introduction

wechaty-robot

基于 wechaty-puppet-padplus 协议的微信机器人助手,适用于微信好友管理及群管理,可以帮你省去一系列重复繁琐的操作。

功能

  • 自动处理好友请求
  • 私聊关键字回复
  • 通过指令完成指定任务
  • 群管理(拉人进群、踢人出群、@群成员)
  • 发送图片、链接、名片

结构

|-- img                     # 储项目所使用到的图片与其他相应资源。
|-- src/
|---- listeners/
|------ on-scan.js          # 机器人需要扫描二维码时监听回调
|------ on-room.js          # 进入房间监听回调
|------ on-message.js       # 消息监听回调
|------ on-friend.js        # 好友添加监听回调
|---- config.js             # 配置文件
|---- index.js              # 入口文件
|-- package.json

依赖

wechaty:wechaty 核心库
wechaty-puppet-padplus:wechaty 的 ipad 协议实现

代码介绍

// init
const bot = new Wechaty({
  puppet: new PuppetPadplus({
    token: config.token
  }),
  name: config.name
})

bot.on('scan', onScan) // 机器人需要扫描二维码时监听
bot.on('login', (user) => log.info('StarterBot', '%s login', user))
bot.on('logout', (user) => log.info('StarterBot', '%s logout', user))
bot.on('message', onMessage(bot)) // 消息监听
bot.on('friendship', onFriendShip) // 添加好友监听
bot.on('room-join', onRoomJoin) // 加入房间监听

bot
  .start()
  .then(() => {
    log.info('StarterBot', 'Starter Bot Started.')
  })
  .catch((e) => log.error('StarterBot', e))

本地运行

  1. 克隆项目
git clone https://github.com/zoudingyi/wechaty-robot.git

cd wechaty-robot
  1. 安装依赖
npm install
  1. 启动项目
npm run serve

使用

修改config配置

打开`src/config.js` 文件,将里面的配置改为自己的。然后就可以运行了

效果图

效果图

wechaty-robot's People

Contributors

zoudingyi avatar

Watchers

James Cloos 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.