- [Wechaty](/api/wechaty)
Main bot class.
A
Bot
is a wechat client depends on which puppet you use. It may equals- web-wechat, when you use: puppet-puppeteer/puppet-wechat4u
- ipad-wechat, when you use: puppet-padchat
- ios-wechat, when you use: puppet-ioscat
See more:
If you want to know how to send message, see [Message](/api/message)
If you want to know how to get contact, see [Contact](/api/contact)- [Room](/api/room)
All wechat rooms(groups) will be encapsulated as a Room.
- [Contact](/api/contact)
All wechat contacts(friend) will be encapsulated as a Contact.
- [Friendship](/api/friendship)
Send, receive friend request, and friend confirmation events.
- send request
- receive request(in friend event)
- confirmation friendship(friend event)
- [Message](/api/message)
All wechat messages will be encapsulated as a Message.
-
[PuppetName](/api/?id=puppetname)
The term Puppet in Wechaty is an Abstract Class for implementing protocol plugins. The plugins are the component that helps Wechaty to control the Wechat(that's the reason we call it puppet). The plugins are named XXXPuppet, for example:
[WechatyOptions](/api/?id=wechatyoptions)
The option parameter to create a wechaty instance
[WechatyEventName](/api/?id=wechatyeventname)
Wechaty Class Event Type
[WechatyEventFunction](/api/?id=wechatyeventfunction)
Wechaty Class Event Function
[RoomQueryFilter](/api/?id=roomqueryfilter)
The filter to find the room: {topic: string | RegExp}
[RoomEventName](/api/?id=roomeventname)
Room Class Event Type
[RoomEventFunction](/api/?id=roomeventfunction)
Room Class Event Function
[RoomMemberQueryFilter](/api/?id=roommemberqueryfilter)
The way to search member by Room.member()
[ContactQueryFilter](/api/?id=contactqueryfilter)
The way to search Contact
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
wechat4u | string |
The default puppet, using the wechat4u to control the WeChat Web API via a chrome browser. |
padchat | string |
- Using the WebSocket protocol to connect with a Protocol Server for controlling the iPad Wechat program. |
puppeteer | string |
- Using the google puppeteer to control the WeChat Web API via a chrome browser. |
mock | string |
- Using the mock data to mock wechat operation, just for test. |
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
profile | string |
Wechaty Name. When you set this: new Wechaty({profile: 'wechatyName'}) it will generate a file called wechatyName.memory-card.json . This file stores the bot's login information. If the file is valid, the bot can auto login so you don't need to scan the qrcode to login again. Also, you can set the environment variable for WECHATY_PROFILE to set this value when you start. eg: WECHATY_PROFILE="your-cute-bot-name" node bot.js |
puppet | PuppetName | Puppet |
Puppet name or instance |
puppetOptions | Partial.<PuppetOptions> |
Puppet TOKEN |
ioToken | string |
Io TOKEN |
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
error | string |
When the bot get error, there will be a Wechaty error event fired. |
login | string |
After the bot login full successful, the event login will be emitted, with a Contact of current logined user. |
logout | string |
Logout will be emitted when bot detected log out, with a Contact of the current login user. |
heartbeat | string |
Get bot's heartbeat. |
friend | string |
When someone sends you a friend request, there will be a Wechaty friend event fired. |
message | string |
Emit when there's a new message. |
room-join | string |
Emit when anyone join any room. |
room-topic | string |
Get topic event, emitted when someone change room topic. |
room-leave | string |
Emit when anyone leave the room. If someone leaves the room by themselves, wechat will not notice other people in the room, so the bot will never get the "leave" event. |
scan | string |
A scan event will be emitted when the bot needs to show you a QR Code for scanning. It is recommend to install qrcode-terminal(run npm install qrcode-terminal ) in order to show qrcode in the terminal. |
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
error | function |
(this: Wechaty, error: Error) => void callback function |
login | function |
(this: Wechaty, user: ContactSelf)=> void |
logout | function |
(this: Wechaty, user: ContactSelf) => void |
scan | function |
(this: Wechaty, url: string, code: number) => void
|
heartbeat | function |
(this: Wechaty, data: any) => void |
friendship | function |
(this: Wechaty, friendship: Friendship) => void |
message | function |
(this: Wechaty, message: Message) => void |
room-join | function |
(this: Wechaty, room: Room, inviteeList: Contact[], inviter: Contact) => void |
room-topic | function |
(this: Wechaty, room: Room, newTopic: string, oldTopic: string, changer: Contact) => void |
room-leave | function |
(this: Wechaty, room: Room, leaverList: Contact[]) => void |
Kind: global typedef
Properties
Name | Type |
---|---|
topic | string |
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
join | string |
Emit when anyone join any room. |
topic | string |
Get topic event, emitted when someone change room topic. |
leave | string |
Emit when anyone leave the room. If someone leaves the room by themselves, wechat will not notice other people in the room, so the bot will never get the "leave" event. |
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
room-join | function |
(this: Room, inviteeList: Contact[] , inviter: Contact) => void |
room-topic | function |
(this: Room, topic: string, oldTopic: string, changer: Contact) => void |
room-leave | function |
(this: Room, leaver: Contact) => void |
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
name | string |
Find the contact by wechat name in a room, equal to Contact.name() . |
roomAlias | string |
Find the contact by alias set by the bot for others in a room. |
contactAlias | string |
Find the contact by alias set by the contact out of a room, equal to Contact.alias() . More Detail |
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
name | string |
The name-string set by user-self, should be called name |
alias | string |
The name-string set by bot for others, should be called alias More Detail |