Total Complexity | 2 |
Total Lines | 37 |
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 | Sent when the user clicks a Rich Presence join invite in chat |
||
6 | to join a game. |
||
7 | """ |
||
8 | |||
9 | from ..objects.events.activity import ActivityJoinEvent |
||
10 | from ..utils.conversion import construct_client_dict |
||
11 | from ..core.dispatch import GatewayDispatch |
||
12 | from ..utils.types import Coro |
||
13 | |||
14 | |||
15 | async def activity_join_middleware(self, payload: GatewayDispatch): |
||
16 | """|coro| |
||
17 | |||
18 | Middleware for ``on_activity_join`` event. |
||
19 | |||
20 | Parameters |
||
21 | ---------- |
||
22 | payload : :class:`GatewayDispatch` |
||
23 | The data received from the activity join event. |
||
24 | |||
25 | Returns |
||
26 | ------- |
||
27 | Tuple[:class:`str`, List[:class:`ActivityJoinEvent`]] |
||
28 | ``on_activity_join`` and an ``ActivityJoinEvent`` |
||
29 | """ |
||
30 | return "on_activity_join", [ |
||
31 | ActivityJoinEvent.from_dict(construct_client_dict(self, payload.data)) |
||
32 | ] |
||
33 | |||
34 | |||
35 | def export() -> Coro: |
||
|
|||
36 | return activity_join_middleware |
||
37 |