14 lines
512 B
Python
14 lines
512 B
Python
from typing import Optional
|
|
|
|
from bot.database.db import get_all_users
|
|
from bot.database.models import User as DbUser
|
|
|
|
async def get_partner(current_user_id: int) -> Optional[DbUser]:
|
|
"""Находит второго зарегистрированного пользователя (партнера)."""
|
|
users = await get_all_users()
|
|
if len(users) != 2:
|
|
return None
|
|
for user in users:
|
|
if user.id is not None and user.id != current_user_id:
|
|
return user
|
|
return None |