Package Exports
- wechaty
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wechaty) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Wechaty
Connecting ChatBots.
Wechaty is a Bot Framework for Wechat Personal Account that helps you easy creating bot in 6 lines of javascript, with cross-platform support include Linux, Windows, Darwin(OSX/Mac) and Docker.
:octocat: https://github.com/wechaty/wechaty
🪲 https://github.com/wechaty/wechaty/issues
📖 https://github.com/wechaty/wechaty/wiki
🐳 https://hub.docker.com/r/zixia/wechaty
Voice of the Developer
@JasLin: the best wechat SDK I have seen in Github! link
@Jarvis: 最好的微信开发库 link
@ccaapton: wechaty library fantastic! link
@ak5: it's quite cool! link
@Samurais: wechaty is great. link
@naishstar: thanks for great SDK link
Example
The shortest wechat bot code in the world: 6 lines JavaScript
const { Wechaty } = require('wechaty')
Wechaty.instance() // Singleton
.on('scan', (url, code) => console.log(`Scan QR Code to login: ${code}\n${url}`))
.on('login', user => console.log(`User ${user} logined`))
.on('message', message => console.log(`Message: ${message}`))
.init()This bot can log all message to console.
You can find more example from Wiki and Example Directory.
Run
Let's say, you have saved the above six lines javascript example to mybot.js.
We have two options to run wechaty:
- Docker
- NPM
Docker
$ alias wechaty='docker run \
-t -i --rm \
--volume="$(pwd)":/bot \
--name=wechaty \
zixia/wechaty \
'
$ wechaty mybot.js- Wechaty Docker has native support for TypeScript as well: just write in TypeScript and save to
mybot.ts, then runwechaty mybot.ts.
Get to know more about Wechaty Docker from here.
NPM
$ npm install --save wechaty
$ node mybot.jsYou might be asked for install the chromedriver, depends on which platform you are.
Get to know more about NPM at Wiki
API Reference
Wechaty
- init(): Promise<void>
- instance(setting: PuppetSetting): Promise<Wechaty>
- send(message: Message): Promise<void>
- say(content: string): Promise<void>
Wechaty Event
Contact
TBW
FriendRequest
TBW
Message
TBW
Room
TBW
Room Event
Test
Wechaty use AVA for unit testing
To test Wechaty, run:
npm testGet to know more about test from Wiki:Test
Release Notes
- Latest Release(All releases here)
- Changelog
Powered By Wechaty
Wechaty Badge
Get embed html/markdown code from Wiki:PoweredByWechaty
Projects Use Wechaty
- Wechaty.io ChatBot Portal Manager for Wechaty
Know more about Projects Use Wechaty at Wiki:PoweredByWechaty
Contributing
Howto contribute
See Also
My Story
My daily life/work depends on too much chat on wechat.
- I almost have 14,000 wechat friends in May 2014, before wechat restricts a total number of friends to 5,000.
- I almost have 400 wechat rooms that most of them have more than 400 members.
Can you image that? I'm dying...
So a tireless bot working for me 24x7 on wechat, monitoring/filtering the most important message is badly needed. For example highlights discussion which contains the KEYWORDS which I want to follow up(especially in a noisy room). ;-)
At last, It's built for my personal study purpose of Automatically Testing.
Author
Zhuohuan LI zixia@zixia.net (http://linkedin.com/in/zixia)
Copyright & License
- Code & Docs 2016© zixia
- Code released under the ISC license
- Docs released under Creative Commons
