qa-and-rag-ai-assistant/authorizer.py
2026-01-13 15:38:27 +03:00

36 lines
785 B
Python

from dataclasses import dataclass
import random
@dataclass
class Statuses:
PENDING: str = "pending"
COMPLETED: str = "completed"
def get_gen_token() -> str:
"""Generate a numeric token and return it as a string.
Uses integers for randint endpoints to avoid TypeError.
"""
return str(random.randint(1, 10 ** 12))
bot_name = "test_bot"
gen_token = get_gen_token()
link = f"https://t.me/{bot_name}?start={gen_token}"
# Minimal ORM/connector placeholder
class BotConnector:
def __init__(self):
# Initialize DB connection or client here
pass
def authorize(self, token: str, telegram_user_id: int):
"""Mark token as completed / link token to telegram user id.
Implement DB write logic here.
"""
pass