@@ -177,7 +177,7 @@ async def restrict_user(gid, uid):
177177async def ban_user (gid , uid ):
178178 logging .info ("ban user %s in group %s" , uid , gid )
179179 with contextlib .suppress (Exception ):
180- _ = await app .ban_chat_member (gid , uid )
180+ await app .ban_chat_member (gid , uid )
181181
182182 # only for dev
183183 if os .getenv ("MODE" ) == "dev" :
@@ -187,20 +187,22 @@ async def ban_user(gid, uid):
187187
188188
189189async def un_restrict_user (gid , uid ):
190- await app .restrict_chat_member (
191- gid ,
192- uid ,
193- types .ChatPermissions (
194- can_send_messages = True ,
195- can_send_media_messages = True ,
196- can_send_other_messages = True ,
197- can_send_polls = True ,
198- can_add_web_page_previews = True ,
199- can_invite_users = False ,
200- can_change_info = False ,
201- can_pin_messages = False ,
202- ),
203- )
190+ logging .info ("unban user %s in group %s" , uid , gid )
191+ with contextlib .suppress (Exception ):
192+ await app .restrict_chat_member (
193+ gid ,
194+ uid ,
195+ types .ChatPermissions (
196+ can_send_messages = True ,
197+ can_send_media_messages = True ,
198+ can_send_other_messages = True ,
199+ can_send_polls = True ,
200+ can_add_web_page_previews = True ,
201+ can_invite_users = False ,
202+ can_change_info = False ,
203+ can_pin_messages = False ,
204+ ),
205+ )
204206
205207
206208async def invalid_queue (gid_uid ):
@@ -209,7 +211,6 @@ async def invalid_queue(gid_uid):
209211
210212async def check_idle_verification ():
211213 for group_id , ts in (await redis_client .hgetall ("queue" )).items ():
212- time .sleep (random .random ())
213214 if time .time () - float (ts ) > IDLE_SECONDS :
214215 logging .info ("Idle verification for %s" , group_id )
215216 await delete_captcha (group_id )
0 commit comments