Skip to content

Commit

Permalink
Merge pull request #93 from juzibot/fix/admin-list
Browse files Browse the repository at this point in the history
feat: ✨ support get room admin list
  • Loading branch information
su-chang authored Dec 10, 2024
2 parents bac4e46 + 8e789d4 commit 0fb1d61
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@juzi/wechaty",
"version": "1.0.104",
"version": "1.0.105",
"description": "Wechaty is a RPA SDK for Chatbot Makers.",
"type": "module",
"exports": {
Expand Down
24 changes: 24 additions & 0 deletions src/user-modules/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,30 @@ class RoomMixin extends MixinBase implements SayableSayer {
return owner
}

/**
* Get room's admin list from the room.
* > Tips:
* This function is depending on the Puppet Implementation, see [puppet-compatible-table](https://github.com/wechaty/wechaty/wiki/Puppet#3-puppet-compatible-table)
* @returns {(ContactInterface[])}
* @example
* const adminList = room.adminList()
*/
async adminList (): Promise<ContactInterface[]> {
log.verbose('Room', 'adminList()')

if (!this.isReady()) {
log.warn('Room', 'adminList() room not ready')
return []
}

if (this.payload!.adminIdList.length === 0) {
return []
}

const adminList = await (this.wechaty.Contact as any as typeof ContactImpl).batchLoadContacts(this.payload!.adminIdList)
return adminList
}

/**
* Get avatar from the room.
* @returns {FileBox}
Expand Down

0 comments on commit 0fb1d61

Please sign in to comment.