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(
281281 channel_id = channel_id ,
282282 group_id = group_id ,
283283 )
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__(
2929 groups_count : Optional [int ] = None ,
3030 channels_count : Optional [int ] = None ,
3131 default_channel : Optional [Channel ] = None ,
32- visible : Optional [bool ] = True
32+ visible : Optional [bool ] = True ,
3333 ):
3434 super ().__init__ (app )
3535 self .id = id
@@ -76,7 +76,9 @@ def to_json(self) -> JSONDict:
7676 "numberOfGroups" : self .groups_count ,
7777 "numberOfChannels" : self .channels_count ,
7878 "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+ ),
8082 }
8183
8284 def from_json (self , data : Optional [JSONDict ]) -> Optional ["Community" ]:
You can’t perform that action at this time.
0 commit comments