Browse Source

Adding RP Support

pull/133/head
ThatGuyJustin 6 years ago
parent
commit
8651677230
  1. 38
      disco/types/user.py

38
disco/types/user.py

@ -1,6 +1,6 @@
from holster.enum import Enum from holster.enum import Enum
from datetime import datetime
from disco.types.base import SlottedModel, Field, snowflake, text, with_equality, with_hash from disco.types.base import SlottedModel, Field, snowflake, text, with_equality, with_hash, ListField
DefaultAvatars = Enum( DefaultAvatars = Enum(
BLURPLE=0, BLURPLE=0,
@ -69,12 +69,44 @@ Status = Enum(
'OFFLINE', 'OFFLINE',
) )
class Party(SlottedModel):
id = Field(text)
size = ListField(int)
class Assets(SlottedModel):
large_image = Field(text)
large_text = Field(text)
small_image = Field(text)
small_text = Field(text)
class Secrets(SlottedModel):
join = Field(text)
spectate = Field(text)
match = Field(text)
class Timestamps(SlottedModel):
start = Field(int)
end = Field(int)
def start_time(self):
return datetime.utcfromtimestamp(self.start / 1000)
def end_time(self):
return datetime.utcfromtimestamp(self.end / 1000)
class Game(SlottedModel): class Game(SlottedModel):
type = Field(GameType) type = Field(GameType)
name = Field(text) name = Field(text)
url = Field(text) url = Field(text)
timestamps = Field(Timestamps)
application_id = Field(text)
details = Field(text)
state = Field(text)
party = Field(Party)
assets = Field(Assets)
secrets = Field(Secrets)
instance = Field(bool)
flags = Field(int)
class Presence(SlottedModel): class Presence(SlottedModel):
user = Field(User, alias='user', ignore_dump=['presence']) user = Field(User, alias='user', ignore_dump=['presence'])

Loading…
Cancel
Save