1from dataclasses
import dataclass
7 A class representing a user in a lobby.
9 In some places, "id-only users" are used, which are users that only have an ID
10 and no username or location attached. These are where the original Talkomatic
11 API only specifies a user ID, and not a username or location. You can still
12 try retrieving the username and location from the bot if the user is stored
13 in the bot's currently online user database, but this is not guaranteed.
16 - id: The user's raw ID in web safe Base64 encoding.
17 - username: The user's username. (doesn't apply if the user is a "id-only user")
18 - location: The user's location. (doesn't apply if the user is a "id-only user")
19 - id_only: Whether the user is an "id-only user".
30 id = data[
"id" if "id" in data
else "userId"],
31 username = data[
"username"],
32 location = data[
"location"],
38 return cls.
from_raw_json({
"id": id,
"username":
"",
"location":
""}, id_only =
True)
40 def __eq__(self, other:
"User") -> bool:
41 if not isinstance(other, User):
44 return self.
id == other.id
46 def __ne__(self, other:
"User") -> bool:
47 return not self.
__eq__(other)
50 return f
'User "{self.username} / {self.location}" with id: {self.id}{" (id-only)" if self.id_only else ""}'
bool __eq__(self, "User" other)
bool __ne__(self, "User" other)
"User" from_id_only(cls, str id)
"User" from_raw_json(cls, dict data, bool id_only=False)