mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-03-05 05:36:54 +08:00
25 lines
564 B
Python
25 lines
564 B
Python
from abc import ABC, abstractmethod
|
|
from typing import Any, Generic, TypeVar
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from ..utils.typing import GameType
|
|
|
|
T = TypeVar('T', bound=GameType)
|
|
|
|
|
|
class BaseUser(BaseModel, ABC, Generic[T]):
|
|
"""游戏用户"""
|
|
|
|
platform: T
|
|
|
|
def __eq__(self, other: Any) -> bool: # noqa: ANN401
|
|
if isinstance(other, BaseUser):
|
|
return self.unique_identifier == other.unique_identifier
|
|
return False
|
|
|
|
@property
|
|
@abstractmethod
|
|
def unique_identifier(self) -> str:
|
|
raise NotImplementedError
|