about summary refs log tree commit diff stats
path: root/discord
diff options
context:
space:
mode:
Diffstat (limited to 'discord')
-rw-r--r--discord/client.py5
-rw-r--r--discord/user.py22
2 files changed, 26 insertions, 1 deletions
diff --git a/discord/client.py b/discord/client.py
index c500d1c..c61c4b9 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -5,6 +5,8 @@ import threading
 import websockets
 from typing import Coroutine
 from discord.intents import Intents, gen_number
+from discord.user import User
+
 
 class Client:
     def __init__(self, intents: list[Intents]):
@@ -35,6 +37,7 @@ class Client:
             ready = await gateway.recv()
             if (hasattr(self, 'on_ready')):
                 await getattr(self, 'on_ready')()
+            self.user = User(json.loads(ready)['d']['user'])
 
     async def heartbeat(self, gateway: websockets.WebSocketClientProtocol, interval: int):
         while True:
@@ -55,4 +58,4 @@ class Client:
 
     def run(self, token: str):
         self.token = token
-        asyncio.run(self.connect(self.token, self.code))
+        asyncio.run(self.connect(self.token, self.code))
\ No newline at end of file
diff --git a/discord/user.py b/discord/user.py
index e69de29..838b6e2 100644
--- a/discord/user.py
+++ b/discord/user.py
@@ -0,0 +1,22 @@
+class User:
+    __slots__ = (
+        "id",
+        "username",
+        "discriminator",
+        "avatar",
+        "bot",
+        "system",
+        "mfa_enabled",
+        "banner",
+        "accent_color",
+        "locale",
+        "verified",
+        "email",
+        "flags",
+        "premium_type",
+        "public_flags"
+    )
+
+    def __init__(self, data: dict):
+        for k, v in data:
+            setattr(self, k, v)