feat: Tái cấu trúc bot sang kiến trúc cog, thêm hỗ trợ đa máy chủ, giới thiệu tính năng đăng ký bóng đá, giao diện web và quản lý cấu hình.

This commit is contained in:
2026-01-16 17:26:42 +07:00
parent 8c38357c28
commit b24365927a
39 changed files with 3864 additions and 997 deletions
+44
View File
@@ -0,0 +1,44 @@
import asyncio
from services.football_api import FootballApiService
from repositories.config import ConfigRepository
async def test_search():
# Use the guild ID from the logs: 536422615649091595
# We need the API Key. I can try to read it from DB or just rely on the existing modules.
# The ConfigRepository can fetch it.
config_repo = ConfigRepository()
guild_id = 536422615649091595
key = await config_repo.get(guild_id, "FOOTBALL_API_KEY", "")
if not key:
print("No API Key found for test.")
return
print(f"Using Key: {key[:5]}...")
api = FootballApiService(key)
queries = ["chelsea", "man utd", "köln", "ch"]
for q in queries:
print(f"\n--- Searching for: {q} ---")
try:
# We want to see the raw teams list, so let's check _get directly if possible, or modify search logic temporarily
endpoint = f"/teams?name={q}"
data = await api._get(endpoint, cache_ttl=0)
if not data:
print("No Data")
continue
teams = data.get("teams", [])
print(f"Count: {data.get('count')}")
for t in teams:
print(f" - [{t['id']}] {t['name']} (Short: {t.get('shortName')})")
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
asyncio.run(test_search())