1
|
|
|
# Copyright Pincer 2021-Present |
|
|
|
|
2
|
|
|
# Full MIT License can be found in `LICENSE` at the project root. |
3
|
|
|
from __future__ import annotations |
4
|
|
|
|
5
|
|
|
from dataclasses import dataclass |
6
|
|
|
from typing import TYPE_CHECKING |
7
|
|
|
|
8
|
|
|
from ...utils.api_object import APIObject |
9
|
|
|
from ...utils.types import MISSING, APINullable |
10
|
|
|
|
11
|
|
|
if TYPE_CHECKING: |
12
|
|
|
from typing import List, Tuple |
13
|
|
|
|
14
|
|
|
from ..user.user import User |
15
|
|
|
from ..guild.guild import Guild |
16
|
|
|
from ..app.application import Application |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
@dataclass(repr=False) |
20
|
|
|
class HelloEvent(APIObject): |
21
|
|
|
"""Sent on connection to the websocket. |
22
|
|
|
Defines the heartbeat interval that the client should heartbeat to. |
23
|
|
|
|
24
|
|
|
Attributes |
25
|
|
|
---------- |
26
|
|
|
heartbeat_interval: :class:`int` |
27
|
|
|
The interval (in milliseconds) the client should heartbeat with |
28
|
|
|
""" |
29
|
|
|
|
30
|
|
|
heartbeat_interval: int |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
@dataclass(repr=False) |
34
|
|
|
class ReadyEvent(APIObject): |
35
|
|
|
"""Dispatched when a client has completed the initial |
36
|
|
|
handshake with the gateway (for new sessions). |
37
|
|
|
|
38
|
|
|
Attributes |
39
|
|
|
---------- |
40
|
|
|
v: :class:`int` |
41
|
|
|
Gateway version |
42
|
|
|
user: :class:`~pincer.objects.user.user.User` |
43
|
|
|
Information about the user including email |
44
|
|
|
guilds: List[:class:`~pincer.objects.guild.guild.Guild`] |
45
|
|
|
The guilds the user is in |
46
|
|
|
session_id: :class:`str` |
47
|
|
|
Used for resuming connections |
48
|
|
|
application: :class:`~pincer.objects.app.application.Application` |
49
|
|
|
Contains ``id`` and ``flags`` |
50
|
|
|
shard: APINullable[Tuple[:class:`int`, :class:`int`]] |
51
|
|
|
The shard information associated |
52
|
|
|
with this session, if sent when identifying |
53
|
|
|
""" |
54
|
|
|
|
55
|
|
|
v: int |
56
|
|
|
user: User |
57
|
|
|
guilds: List[Guild] |
58
|
|
|
session_id: str |
59
|
|
|
application: Application |
60
|
|
|
|
61
|
|
|
shard: APINullable[Tuple[int, int]] = MISSING |
62
|
|
|
|