Skip to content

Latest commit

 

History

History
254 lines (184 loc) · 6.24 KB

index.md

File metadata and controls

254 lines (184 loc) · 6.24 KB

Classes

Wechaty

Wechaty: Wechat for ChatBots. Connect ChatBots

Class Wechaty

Licenst: ISC https://github.com/zixia/wechaty

Example

// The World's Shortest ChatBot Code: 6 lines of 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()

Room

wechaty: Wechat for Bot. and for human who talk to bot/robot

Licenst: ISC https://github.com/zixia/wechaty

Add/Del/Topic: wechaty#32

Contact

Class Contact blabla... IMPORTANT

Constants

config_1

Wechaty: Wechaty - Wechat for Bot. Connecting ChatBots

Licenst: ISC https://github.com/wechaty/wechaty

Wechaty

Wechaty: Wechat for ChatBots. Connect ChatBots

Class Wechaty

Licenst: ISC https://github.com/zixia/wechaty

Example

// The World's Shortest ChatBot Code: 6 lines of 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()

Kind: global class
See: The Wechaty Starter Project

wechaty.version([forceNpm]) ⇒ string

Return version of Wechaty

Kind: instance method of Wechaty
Returns: string - - the version number

Param Type Default Description
[forceNpm] boolean false if set to true, will only return the version in package.json. otherwise will return git commit hash if .git exists.

Example

console.log(Wechaty.instance().version())
 // '#git[af39df]'
 console.log(Wechaty.instance().version(true))
 // '0.7.9'

wechaty.user() ⇒ Contact

Deprecated

Kind: instance method of Wechaty
Todo

  • document me

wechaty.init()

Kind: instance method of Wechaty
Todo

  • document me

wechaty.on()

Kind: instance method of Wechaty
Todo

  • document me

wechaty.quit()

Kind: instance method of Wechaty
Todo

  • document me

wechaty.logout()

Kind: instance method of Wechaty
Todo

  • document me

wechaty.self() ⇒ Contact

get current user

Kind: instance method of Wechaty
Returns: Contact - current logined user

wechaty.send()

Kind: instance method of Wechaty
Todo

  • document me

wechaty.say()

Kind: instance method of Wechaty
Todo

  • document me

wechaty.sleep()

Kind: instance method of Wechaty
Todo

  • document me

Wechaty.instance()

get the singleton instance of Wechaty

Kind: static method of Wechaty

Room

wechaty: Wechat for Bot. and for human who talk to bot/robot

Licenst: ISC https://github.com/zixia/wechaty

Add/Del/Topic: wechaty#32

Kind: global class

Room.load()

Kind: static method of Room
Todo

  • document me

Contact

Class Contact blabla... IMPORTANT

Kind: global class

contact.gender() ⇒

Contact gender

Kind: instance method of Contact
Returns: Gender.Male(2) | Gender.Female(1) | Gender.Unknown(0)

contact.avatar()

Get avatar picture file stream

Kind: instance method of Contact

Contact.findAll()

find contact by name or alias

Kind: static method of Contact

Contact.find()

try to find a contact by filter: {name: string | RegExp}

Kind: static method of Contact

config_1

Wechaty: * * Wechaty - Wechat for Bot. Connecting ChatBots

Licenst: ISC https://github.com/wechaty/wechaty

Kind: global constant