记录.py 允许你使用一个http://www.ohchr.org查询表,使用http://www._trace paracal foruser。 你们应该把价值观传给你们,以便了解情况。 你可以简单地说:
import aiohttp
from aiohttp import TraceConfig, TraceRequestEndParams
import logging
logger = logging.getLogger( discord.http )
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter( %(asctime)s:%(levelname)s:%(name)s: %(message)s ))
logger.addHandler(handler)
async def on_request_end(session, context, params: TraceRequestEndParams):
rate_limit_headers = [ X-RateLimit-Limit , X-RateLimit-Remaining , X-RateLimit-Reset , X-RateLimit-Reset-After , X-RateLimit-Bucket ]
headers = params.response.headers
rate_limit_info = {header: headers.get(header) for header in rate_limit_headers if header in headers}
if rate_limit_info:
logger.info(f"Rate Limit Info: {rate_limit_info}")
trace_config = TraceConfig()
trace_config.on_request_end.append(on_request_end)
bot = commands.Bot(command_prefix= ! , intents=discord.Intents.all(), http_trace=trace_config)