поменял ключ

This commit is contained in:
vrubel 2025-10-29 00:59:36 +03:00
parent 05fc7c21ea
commit 9e79b97672
2 changed files with 10 additions and 2 deletions

View file

@ -205,6 +205,10 @@ class LichessBot:
ratings_data = await self.lichess_api.get_user_ratings(username)
logger.debug(f"Received ratings for {username}: {ratings_data is not None}")
# Add delay between requests to avoid rate limiting
if i < len(gamers) - 1: # Don't sleep after the last one
await asyncio.sleep(0.5) # 500ms delay between requests
if ratings_data and 'perfs' in ratings_data:
perfs = ratings_data['perfs']
bullet_rating = perfs.get('bullet', {}).get('rating', 'N/A')
@ -325,13 +329,17 @@ class LichessBot:
text_lines = []
keyboard = []
for gamer in gamers:
for i, gamer in enumerate(gamers):
status = "🟢" if gamer['is_active'] else ""
username = gamer['username']
# Get user ratings from Lichess API
ratings_data = await self.lichess_api.get_user_ratings(username)
# Add delay between requests to avoid rate limiting
if i < len(gamers) - 1: # Don't sleep after the last one
await asyncio.sleep(0.5) # 500ms delay between requests
if ratings_data and 'perfs' in ratings_data:
perfs = ratings_data['perfs']
bullet_rating = perfs.get('bullet', {}).get('rating', 'N/A')

View file

@ -4,7 +4,7 @@ from dotenv import load_dotenv
load_dotenv()
# Telegram Bot Configuration
TELEGRAM_BOT_TOKEN = "8241474807:AAGcsLiaE9El63ARmUgrWASgkhcBv8QB1c8"
TELEGRAM_BOT_TOKEN = "8241474807:AAH684LTY93aXRou4-LtqU5-p8LuEjzYn8U"
# Lichess API Configuration
LICHESS_API_BASE_URL = "https://lichess.org/api"