This commit is contained in:
levina 2022-02-02 18:27:00 +07:00 committed by GitHub
parent 2da806e56c
commit 6172eb0b4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,4 @@
import asyncio import asyncio
import logging
from datetime import datetime from datetime import datetime
from sys import version_info from sys import version_info
@ -42,14 +41,6 @@ TIME_DURATION_UNITS = (
) )
logging.getLogger("pyrogram").setLevel(logging.WARNING)
logging.basicConfig(
level=logging.INFO,
datefmt="[%d/%m/%Y %H:%M:%S]",
format=" %(asctime)s - [APPROVE-CHAT] >> %(levelname)s << %(message)s",
handlers=[logging.FileHandler("approvechat.log"), logging.StreamHandler()])
async def _human_time_duration(seconds): async def _human_time_duration(seconds):
if seconds == 0: if seconds == 0:
return "inf" return "inf"
@ -162,7 +153,6 @@ async def approve_join_chat(c: Client, m: ChatJoinRequest):
try: try:
await c.approve_chat_join_request(m.chat.id, m.from_user.id) await c.approve_chat_join_request(m.chat.id, m.from_user.id)
except FloodWait as e: except FloodWait as e:
logging.info(f"Sleeping for {e.x + 2} seconds due to floodwaits!")
await asyncio.sleep(e.x + 2) await asyncio.sleep(e.x + 2)
await c.approve_chat_join_request(m.chat.id, m.from_user.id) await c.approve_chat_join_request(m.chat.id, m.from_user.id)