Total Complexity | 2 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # Copyright Pincer 2021-Present |
||
2 | # Full MIT License can be found in `LICENSE` at the project root. |
||
3 | |||
4 | """ |
||
5 | non-subscription event sent immediately after connecting, |
||
6 | contains server information |
||
7 | """ |
||
8 | from __future__ import annotations |
||
9 | from asyncio.tasks import ensure_future |
||
|
|||
10 | |||
11 | from typing import TYPE_CHECKING |
||
12 | import logging |
||
13 | |||
14 | if TYPE_CHECKING: |
||
15 | from typing import Tuple |
||
16 | from ..utils.types import Coro |
||
17 | from ..client import Client |
||
18 | from ..core.gateway import Gateway |
||
19 | from ..core.gateway import GatewayDispatch |
||
20 | |||
21 | _log = logging.getLogger(__package__) |
||
22 | |||
23 | |||
24 | async def on_resumed( |
||
25 | self: Client, |
||
26 | gateway: Gateway, |
||
27 | payload: GatewayDispatch |
||
28 | ) -> Tuple[str]: |
||
29 | """|coro| |
||
30 | |||
31 | Middleware for the ``on_resumed`` event. |
||
32 | |||
33 | Parameters |
||
34 | ---------- |
||
35 | payload : :class:`~pincer.core.gateway.GatewayDispatch` |
||
36 | The data received from the stage instance create event |
||
37 | |||
38 | Returns |
||
39 | ------- |
||
40 | Tuple[:class:`str`] |
||
41 | ``on_ready`` |
||
42 | """ |
||
43 | |||
44 | _log.debug( |
||
45 | "%s Sucessfully reconnected to Discord gateway. Restarting heartbeat.", |
||
46 | gateway.shard_key |
||
47 | ) |
||
48 | gateway.start_heartbeat() |
||
49 | |||
50 | return ("on_resumed",) |
||
51 | |||
52 | |||
53 | def export() -> Coro: |
||
54 | return on_resumed |
||
55 |