Total Complexity | 2 |
Total Lines | 41 |
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 | from __future__ import annotations |
||
5 | |||
6 | from typing import TYPE_CHECKING |
||
7 | |||
8 | if TYPE_CHECKING: |
||
9 | from typing import Tuple |
||
10 | |||
11 | from ..client import Client |
||
12 | from ..core.gateway import Gateway |
||
13 | from ..core.gateway import GatewayDispatch |
||
14 | |||
15 | |||
16 | async def payload_middleware( |
||
17 | self: Client, |
||
18 | gateway: Gateway, |
||
19 | payload: GatewayDispatch, |
||
20 | ) -> Tuple[str, GatewayDispatch]: |
||
21 | """Invoked when anything is received from gateway. |
||
22 | |||
23 | |||
24 | Parameters |
||
25 | ---------- |
||
26 | payload : :class:`pincer.core.gateway.GatewayDispatch` |
||
27 | The data received from the ready event. |
||
28 | gateway : :class:`~pincer.core.gateway.Gateway` |
||
29 | The gateway for the current shard. |
||
30 | |||
31 | Returns |
||
32 | ------- |
||
33 | Tuple[:class:`str`, :class:`~pincer.core.gateway.GatewayDispatch`] |
||
34 | ``on_payload`` and a ``payload`` |
||
35 | """ |
||
36 | return "on_payload", payload |
||
37 | |||
38 | |||
39 | def export(): |
||
40 | return payload_middleware |
||
41 |