From ac2958bdf38acc76668b2ec7a83f819341ce1a6f Mon Sep 17 00:00:00 2001 From: suchang Date: Tue, 10 Dec 2024 22:32:09 +0800 Subject: [PATCH 1/3] feat: :sparkles: support get room admin list --- src/user-modules/room.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/user-modules/room.ts b/src/user-modules/room.ts index a573fc8fa..e7e0c9b29 100644 --- a/src/user-modules/room.ts +++ b/src/user-modules/room.ts @@ -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 owner = room.owner() + */ + async adminList (): Promise { + 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} From 72f560dc95637029605bd4780069c2f482ec409a Mon Sep 17 00:00:00 2001 From: suchang Date: Tue, 10 Dec 2024 22:32:21 +0800 Subject: [PATCH 2/3] 1.0.105 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2a71f5cfe..b8dd2d9d1 100644 --- a/package.json +++ b/package.json @@ -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": { From 8e789d482ab726d4611b2a15ddf4b36dd0761c01 Mon Sep 17 00:00:00 2001 From: suchang Date: Tue, 10 Dec 2024 23:20:51 +0800 Subject: [PATCH 3/3] fix: :bug: typo --- src/user-modules/room.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/user-modules/room.ts b/src/user-modules/room.ts index e7e0c9b29..8e99f8bb4 100644 --- a/src/user-modules/room.ts +++ b/src/user-modules/room.ts @@ -1241,7 +1241,7 @@ class RoomMixin extends MixinBase implements SayableSayer { * 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 owner = room.owner() + * const adminList = room.adminList() */ async adminList (): Promise { log.verbose('Room', 'adminList()') @@ -1251,11 +1251,11 @@ class RoomMixin extends MixinBase implements SayableSayer { return [] } - if (this.payload?.adminIdList.length === 0) { + if (this.payload!.adminIdList.length === 0) { return [] } - const adminList = await (this.wechaty.Contact as any as typeof ContactImpl).batchLoadContacts(this.payload?.adminIdList) + const adminList = await (this.wechaty.Contact as any as typeof ContactImpl).batchLoadContacts(this.payload!.adminIdList) return adminList }