Total Complexity | 2 |
Total Lines | 35 |
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 a new user joins a guild. The inner payload is a guild member object |
||
6 | with an extra ``guild_id`` key. |
||
7 | """ |
||
8 | |||
9 | from ..core.dispatch import GatewayDispatch |
||
10 | from ..utils import Coro |
||
11 | from ..utils.conversion import construct_client_dict |
||
12 | from ..objects.events.guild import GuildMemberAddEvent |
||
13 | |||
14 | |||
15 | async def guild_member_add_middleware(self, payload: GatewayDispatch): |
||
16 | """ |
||
17 | Middleware for ``on_guild_member_add`` event. |
||
18 | |||
19 | :param self: |
||
20 | The current client/bot. |
||
21 | |||
22 | :param payload: |
||
23 | The data received from the event. |
||
24 | """ |
||
25 | |||
26 | return "on_guild_member_add", [ |
||
27 | GuildMemberAddEvent.from_dict( |
||
28 | construct_client_dict(self, payload.data) |
||
29 | ) |
||
30 | ] |
||
31 | |||
32 | |||
33 | def export() -> Coro: |
||
|
|||
34 | return guild_member_add_middleware |
||
35 |