Room
所有的微信群都会被封装成 Room 类
Last updated
Was this helpful?
所有的微信群都会被封装成 Room 类
Last updated
Was this helpful?
所有的微信群都会被封装成 Room类。
Kind: global class Properties
Name
Type
Description
id
string
instance
⇒ Promise <void>
⇒ Promise <void>
⇒ this
⇒ Promise <void>
⇒ Promise <void>
⇒ Promise <void>
⇒ Promise <void | string>
⇒ Promise <void | string>
⇒ Promise <string>
⇒ Promise <null | string>
⇒ Promise <boolean>
⇒ Promise <Contact []>
⇒ Promise <null | Contact>
⇒ Contact
| null
⇒ Promise <FileBox>
static
⇒ Promise <Room>
⇒ Promise <Room[]>
⇒ Promise <Room>
Promise <void>
强制加载群的数据,从底层API 重新加载数据。
Promise <void>
在群内发消息,如果设置了 ...mentionList 参数,机器人在群内发送消息的时候还会@这些联系人。
Param
Type
Description
textOrContactOrFileOrUrl
string
| Contact
| FileBox
| UrlLiink
...mentionList
Contact[]
可选参数,当设置这个参数的时候,在群内发送文本消息会@这些联系人。
Example
this
Param
Type
Description
event
群内事件触发
listener
取决于是哪一个事件
Example (Event:join )
Example (Event:leave )
Example (Event:topic )
Example (Event:invite )
Promise <void>
邀请好友加入群聊。
Param
Type
contact
Contact
Example
Promise <void>
将好友移出群聊,这个功能仅在机器人是群主的时候会生效。
Param
Type
contact
Contact
Example
Promise <void>
机器人主动退群。
Promise <void | string>
设置 / 获取 群名称。
Param
Type
Description
newTopic
string
参数可选,如果没有设置,则会获取群名称,如果设置了,则会设置群名称。
Example (当你在群里说话的时候,打印群名称 )
Example (当你在群内说话的时候,机器人修改群名称. )
Promise <void | string>
设置 / 获取 群公告。
Param
Type
Description
text
string
如果设置了这个参数,则会设置群公告,如果没有设置,则是获取群公告。
Example (当你在群里说话的时候,打印群公告. )
Example (当你在群里说话的时候,修改群公告. )
Promise <string>
获取群二维码,用户可以通过扫描这个二维码加入群聊。
Promise <null | string>
获取这个联系人在群内的群昵称。
Param
Type
contact
Contact
Example
Promise <boolean>
检查群内是否有这个群成员。
Param
Type
contact
Contact
Example (Check whether 'lijiarui' is in the room 'wechaty')
Promise <Contact []>
根据 query 获取群内所有的群成员列表。如果没有设置query,返回所有的群成员信息。
name
微信联系人自己设置的昵称,等于 Contact.name()
roomAlias
微信联系人自己在群内设置的昵称。
contactAlias
机器人给微信联系人设置的,等于 Contact.alias()
Param
Type
Description
query
1. RoomMemberQueryFilter 可通过 name, roomAlias, contactAlias 查找指定的群成员。 2. 当memberAll(name) 的参数为string 类型的时候, 返回所有找到的群成员。这里面的name 包括上面定义的name, roomAlias, contactAlias。
Promise <null | Contact>
根据 query 获取群内的群成员。
name
微信联系人自己设置的昵称,等于 Contact.name()
roomAlias
微信联系人自己在群内设置的昵称。
contactAlias
机器人给微信联系人设置的,等于 Contact.alias()
Param
Type
Description
query
RoomMemberQueryFilter 可通过 name, roomAlias, contactAlias 查找指定的群成员。
Contact
| null
获取群主的信息。
Promise <FileBox>
获取群头像的信息。
创建群聊
Param
Type
contactList
Array
topic
string
Example (Creat a room with 'lijiarui' and 'juxiaomi', the room topic is 'ding - created')
Promise <Room []>
通过 {topic: string | RegExp}, 查找群,返回找到的所有群的数组。
Param
Type
query
Example
Promise <Room>
通过 {topic: string | RegExp}, 查找群,如果找到多个群,返回找到的第一个群。
Param
Type
query
Example
查找群的过滤器,{topic: string | RegExp}
Kind: global typedef Properties
Name
Type
topic
string
群事件的类型
Kind: global typedef Properties
Name
Type
Description
join
string
当有人入群的时候,会触发这个事件。
topic
string
当有人修改群名称的时候,会触发这个事件。
leave
string
当有人离群的时候,会触发这个事件。如果是用户主动离群,是无法获取到这个事件的。
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
通过Room.member() 搜索群成员的过滤器
Kind: global typedef Properties
Name
Type
Description
name
string
通过用户的昵称查找群成员,这里面的name 等于Contact.name()
。
roomAlias
string
通过用户设置的群昵称查找群成员。
contactAlias
string
获取群id。这个id 是否是永久不变的id 取决于使用哪一个puppet,具体 。
Kind: instance method of Example
这个功能是否能实现取决于你使用的是哪一个Puppet, 详情参考:
Kind: instance method of
群内发送 text
或者media file
或者链接
。你可以通过 来发送文件。
Kind: instance method of
Returns: this
- - this for chain
这个功能是否能实现取决于你使用的是哪一个Puppet, 详情参考:
基于网页微信开发的用户请查看:
Kind: instance method of
这个功能是否能实现取决于你使用的是哪一个Puppet, 详情参考:
基于网页微信开发的用户请查看:
Kind: instance method of
这个功能是否能实现取决于你使用的是哪一个Puppet, 详情参考:
Kind: instance method of Example
Kind: instance method of
这个功能是否能实现取决于你使用的是哪一个Puppet, 详情参考:
Kind: instance method of
这个功能是否能实现取决于你使用的是哪一个Puppet, 详情参考:
Kind: instance method of
Kind: instance method of
Returns: Promise <null | string>
- - 如果此联系人在群内设置了群昵称则会返回,否则会返回空。
Kind: instance method of
Returns: Promise <boolean>
- Return true
if has contact, else return false
.
Kind: instance method of
| string
Kind: instance method of
| string
这个功能是否能实现取决于你使用的是哪一个Puppet, 详情参考:
Kind: instance method of Example
这个功能是否能实现取决于你使用的是哪一个Puppet, 详情参考:
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
:查找群的过滤器,{topic: string | RegExp}
:群事件的类型
:群事件的方法
: 通过Room.member() 搜索群成员的过滤器
通过机器人给用户设置的备注查找群成员,这里面的contactAlias 等于 Contact.alias()
。 更多细节查看: