DispelEvilBot/common/models/users.py

42 lines
874 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Модели пользователя."""
from __future__ import annotations
from dataclasses import dataclass
@dataclass(slots=True)
class UserInfo:
"""Сводная информация о пользователе (для /инфо)."""
username: str | None
nick: str | None
title: str | None
lvl: int
exp: int
money: int
dt: str
msg_count: int
eggs: int
@property
def exp_max(self) -> int:
"""Порог опыта для текущего уровня."""
return self.lvl * 10
@property
def title_text(self) -> str:
return self.title or ""
@property
def nick_text(self) -> str:
return self.nick or ""
@dataclass(slots=True)
class NickEntry:
"""Пара username/nick из списка участников."""
username: str | None
nick: str | None