| Total Complexity | 2 |
| Total Lines | 56 |
| 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 | |||
| 10 | from typing import TYPE_CHECKING |
||
| 11 | import logging |
||
| 12 | |||
| 13 | if TYPE_CHECKING: |
||
| 14 | from typing import Tuple |
||
|
|
|||
| 15 | from ..utils.types import Coro |
||
| 16 | from ..client import Client |
||
| 17 | from ..core.gateway import Gateway |
||
| 18 | from ..core.gateway import GatewayDispatch |
||
| 19 | |||
| 20 | _log = logging.getLogger(__package__) |
||
| 21 | |||
| 22 | |||
| 23 | async def on_resumed( |
||
| 24 | self: Client, |
||
| 25 | gateway: Gateway, |
||
| 26 | payload: GatewayDispatch |
||
| 27 | ) -> Tuple[str]: |
||
| 28 | """|coro| |
||
| 29 | |||
| 30 | Middleware for the ``on_resumed`` event. |
||
| 31 | |||
| 32 | Parameters |
||
| 33 | ---------- |
||
| 34 | payload : :class:`~pincer.core.gateway.GatewayDispatch` |
||
| 35 | The data received from the stage instance create event |
||
| 36 | gateway : :class:`~pincer.core.gateway.Gateway` |
||
| 37 | The gateway for the current shard. |
||
| 38 | |||
| 39 | Returns |
||
| 40 | ------- |
||
| 41 | Tuple[:class:`str`] |
||
| 42 | ``on_ready`` |
||
| 43 | """ |
||
| 44 | |||
| 45 | _log.debug( |
||
| 46 | "%s Successfully reconnected to Discord gateway. Restarting heartbeat.", |
||
| 47 | gateway.shard_key |
||
| 48 | ) |
||
| 49 | gateway.start_heartbeat() |
||
| 50 | |||
| 51 | return ("on_resumed",) |
||
| 52 | |||
| 53 | |||
| 54 | def export() -> Coro: |
||
| 55 | return on_resumed |
||
| 56 |