@@ -33,9 +33,7 @@ async def get_community(self, community_id: str = "", username: str = ""):
3333 return self .client .build_object (Community , response .data .get ("result" ))
3434
3535 async def update_community (self , community : Community ):
36- response = await self .client .put (
37- BASE_PATH , data = community .to_json_request ()
38- )
36+ response = await self .client .put (BASE_PATH , data = community .to_json_request ())
3937 return self .client .build_object (Community , response .data .get ("result" ))
4038
4139 async def deduct_xp (
@@ -152,3 +150,54 @@ async def get_messaging_bots(
152150 return self .client .build_list (InstantMessaging , response .data .get ("result" ))
153151
154152 # endregion
153+
154+ async def add_premium_member (
155+ self ,
156+ user_id : str ,
157+ community_id : str ,
158+ channel_id : str = None ,
159+ group_id : str = None ,
160+ ):
161+ data = {"userId" : user_id , "communityId" : community_id }
162+ if channel_id :
163+ data ["channelId" ] = channel_id
164+ if group_id :
165+ data ["groupId" ] = group_id
166+ response = await self .client .post (
167+ f"{ BASE_PATH } /premium/member?{ urlencode (data )} "
168+ )
169+ return response .data .get ("success" )
170+
171+ async def delete_premium_member (
172+ self ,
173+ user_id : str ,
174+ community_id : str ,
175+ channel_id : str = None ,
176+ group_id : str = None ,
177+ ):
178+ data = {"userId" : user_id , "communityId" : community_id }
179+ if channel_id :
180+ data ["channelId" ] = channel_id
181+ if group_id :
182+ data ["groupId" ] = group_id
183+ response = await self .client .delete (
184+ f"{ BASE_PATH } /premium/member?{ urlencode (data )} "
185+ )
186+ return response .data .get ("success" )
187+
188+ async def get_premium_members (
189+ self ,
190+ user_id : str ,
191+ community_id : str ,
192+ channel_id : str = None ,
193+ group_id : str = None ,
194+ ):
195+ data = {"userId" : user_id , "communityId" : community_id }
196+ if channel_id :
197+ data ["channelId" ] = channel_id
198+ if group_id :
199+ data ["groupId" ] = group_id
200+ response = await self .client .get (
201+ f"{ BASE_PATH } /premium/member?{ urlencode (data )} "
202+ )
203+ return response .data
0 commit comments