File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -281,3 +281,24 @@ async def get_premium_members(
281
281
channel_id = channel_id ,
282
282
group_id = group_id ,
283
283
)
284
+
285
+ async def list_bots_in_community (self : "swibots.ApiClient" , community_id : str ):
286
+ """List all bots in the community
287
+
288
+ Args:
289
+ community_id (str): Community ID
290
+ """
291
+ community_client = self .community_service .communities .client
292
+ response = await community_client .get (f"/v1/community/bots?communityId={ community_id } " )
293
+ result = response .data ['result' ]
294
+ members = result ['communityMembers' ]
295
+ for member in members :
296
+
297
+ def filterMemberId (x ):
298
+ return int (x ['id' ]) == int (member ['userId' ])
299
+
300
+ userInfo = list (filter (filterMemberId , result ['userInfoList' ]))
301
+ if userInfo :
302
+ member ['userInfo' ] = userInfo [0 ]
303
+
304
+ return community_client .build_list (CommunityMember , members )
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def __init__(
29
29
groups_count : Optional [int ] = None ,
30
30
channels_count : Optional [int ] = None ,
31
31
default_channel : Optional [Channel ] = None ,
32
- visible : Optional [bool ] = True
32
+ visible : Optional [bool ] = True ,
33
33
):
34
34
super ().__init__ (app )
35
35
self .id = id
@@ -76,7 +76,9 @@ def to_json(self) -> JSONDict:
76
76
"numberOfGroups" : self .groups_count ,
77
77
"numberOfChannels" : self .channels_count ,
78
78
"visible" : self .visible ,
79
- "defaultChannel" : self .default_channel .to_json () if self .default_channel else None
79
+ "defaultChannel" : (
80
+ self .default_channel .to_json () if self .default_channel else None
81
+ ),
80
82
}
81
83
82
84
def from_json (self , data : Optional [JSONDict ]) -> Optional ["Community" ]:
You can’t perform that action at this time.
0 commit comments