Total Complexity | 2 |
Total Lines | 38 |
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 user is removed from a guild (leave/kick/ban). |
||
6 | """ |
||
7 | |||
8 | from ..core.dispatch import GatewayDispatch |
||
9 | from ..utils import Coro |
||
10 | from ..utils.conversion import construct_client_dict |
||
11 | from ..objects.events.guild import GuildMemberRemoveEvent |
||
12 | |||
13 | |||
14 | async def guild_member_remove_middleware(self, payload: GatewayDispatch): |
||
15 | """|coro| |
||
16 | |||
17 | Middleware for ``on_guild_member_remove`` event. |
||
18 | |||
19 | Parameters |
||
20 | ---------- |
||
21 | self : :class:`Client` |
||
22 | The current client/bot. |
||
23 | |||
24 | payload : :class:`GatewayDispatch` |
||
25 | The data received from the guild member remove event. |
||
26 | """ |
||
27 | |||
28 | return ( |
||
29 | "on_guild_member_remove", |
||
30 | [GuildMemberRemoveEvent.from_dict( |
||
31 | construct_client_dict(self, payload.data) |
||
32 | )] |
||
33 | ) |
||
34 | |||
35 | |||
36 | def export() -> Coro: |
||
|
|||
37 | return guild_member_remove_middleware |
||
38 |