Room
All wechat rooms(groups) will be encapsulated as a Room.
Last updated
Was this helpful?
All wechat rooms(groups) will be encapsulated as a Room.
Last updated
Was this helpful?
All wechat rooms(groups) will be encapsulated as a Room.
The filter to find the room: {topic: string | RegExp}
Room Class Event Type
Room Class Event Function
The way to search member by Room.member()
All wechat rooms(groups) will be encapsulated as a Room.
Kind: global class Properties
Name
Type
Description
id
string
instance
static
Promise <void>
Force reload data for Room, Sync data from lowlevel API again.
Promise <void>
Send message inside Room, if set mentionList, wechaty will mention the contact list as well.
Param
Type
Description
textOrContactOrFileOrUrlLinkOrMiniProgram
string
| Contact
| FileBox
| UrlLink
| MiniProgram
...mentionList
Contact []
Send content inside Room, and mention @contact list.
Example
this
Param
Type
Description
event
Emit WechatyEvent
listener
Depends on the WechatyEvent
Example (Event:join )
Example (Event:leave )
Example (Event:topic )
Example (Event:invite )
Promise <void>
Add contact in a room
Param
Type
contact
Contact
Example
Promise <void>
Delete a contact from the room It works only when the bot is the owner of the room
Param
Type
contact
Contact
Example
Promise <void>
Bot quit the room itself
Promise <void | string>
SET/GET topic from the room
Param
Type
Description
[newTopic]
string
If set this para, it will change room topic.
Example (When you say anything in a room, it will get room topic. )
Example (When you say anything in a room, it will change room topic. )
Promise <void | string>
SET/GET announce from the room
Tips: It only works when bot is the owner of the room.
Param
Type
Description
[text]
string
If set this para, it will change room announce.
Example (When you say anything in a room, it will get room announce. )
Example (When you say anything in a room, it will change room announce. )
Promise <string>
Get QR Code of the Room from the room, which can be used as scan and join the room.
Promise <string | null>
Return contact's roomAlias in the room
Param
Type
contact
Contact
Example
Promise <boolean>
Check if the room has member contact
, the return is a Promise and must be await
-ed
Param
Type
contact
Contact
Example (Check whether 'lijiarui' is in the room 'wechaty')
Promise <Contact []>
Find all contacts in a room
name
the name-string set by user-self, should be called name, equal to Contact.name()
roomAlias
the name-string set by user-self in the room, should be called roomAlias
contactAlias
the name-string set by bot for others, should be called alias, equal to Contact.alias()
Param
Type
Description
[query]
Optional parameter, When use memberAll(name:string), return all matched members, including name, roomAlias, contactAlias
Example
Promise <Contact | null>
Find all contacts in a room, if get many, return the first one.
Param
Type
Description
queryArg
When use member(name:string), return all matched members, including name, roomAlias, contactAlias
Example (Find member by name)
Example (Find member by MemberQueryFilter)
Contact
| null
Get room's owner from the room.
Promise <FileBox>
Get room's avatar
Create a new room.
Param
Type
contactList
Array
[topic]
string
Example (Creat a room with 'lijiarui' and 'juxiaomi', the room topic is 'ding - created')
Promise <Room []>
Find room by by filter: {topic: string | RegExp}, return all the matched room
Param
Type
[query]
Example
Promise <Room>
Try to find a room by filter: {topic: string | RegExp}. If get many, return the first one.
Param
Type
query
Example
The filter to find the room: {topic: string | RegExp}
Kind: global typedef Properties
Name
Type
topic
string
Room Class Event Type
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.
Room Class Event Function
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
The way to search member by Room.member()
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
Get Room id. This function is depending on the Puppet Implementation, see
⇒ Promise <void>
⇒ Promise <void>
⇒ Room
⇒ Promise <void>
⇒ Promise <void>
⇒ Promise <void>
⇒ Promise <void | string>
⇒ Promise <void | string>
⇒ Promise <string>
⇒ Promise <null | string>
⇒ Promise <boolean>
⇒ Promise <Contact []>
⇒ Promise <Contact | null>
⇒ Contact
| null
⇒ Promise <FileBox>
⇒ Promise <Room>
⇒ Promise <Room []>
⇒ Promise <Room | null>
Kind: instance method of Example
Tips: This function is depending on the Puppet Implementation, see
Kind: instance method of
Send text
, media file
or link
inside Room. You can use to send file
Kind: instance method of Returns: this
- - Room for chain
Tips: This function is depending on the Puppet Implementation, see
see
Kind: instance method of
Tips: This function is depending on the Puppet Implementation, see
see
Kind: instance method of
Tips: This function is depending on the Puppet Implementation, see
Kind: instance method of Example
Kind: instance method of
This function is depending on the Puppet Implementation, see
Kind: instance method of
Tips: This function is depending on the Puppet Implementation, see
Kind: instance method of
Kind: instance method of Returns: Promise <string | null>
- - If a contact has an alias in room, return string, otherwise return null
Kind: instance method of Returns: Promise.
- Return true
if has contact, else return false
.
Kind: instance method of
| string
Kind: instance method of
| string
Tips: This function is depending on the Puppet Implementation, see
Kind: instance method of Example
Tips: This function is depending on the Puppet Implementation, see
Kind: instance method of Example
Kind: static method of
Kind: static method of
Kind: static method of Returns: Promise <Room>
- If can find the room, return Room, or return null
Find the contact by alias set by the contact out of a room, equal to Contact.alias()
.