| Total Complexity | 2 | 
| Total Lines | 39 | 
| 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 guild member is updated. This will also fire when the user object | ||
| 6 | of a guild member changes. | ||
| 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 GuildMemberUpdateEvent | ||
| 13 | |||
| 14 | |||
| 15 | async def guild_member_update_middleware(self, payload: GatewayDispatch): | ||
| 16 | """|coro| | ||
| 17 | |||
| 18 | Middleware for ``on_guild_member_update`` event. | ||
| 19 | |||
| 20 | Parameters | ||
| 21 | ---------- | ||
| 22 | self : :class:`Client` | ||
| 23 | The current client/bot. | ||
| 24 | |||
| 25 | payload : :class:`GatewayDispatch` | ||
| 26 | The data received from the guild member update event. | ||
| 27 | """ | ||
| 28 | |||
| 29 | return ( | ||
| 30 | "on_guild_member_update", | ||
| 31 | [GuildMemberUpdateEvent.from_dict( | ||
| 32 | construct_client_dict(self, payload.data) | ||
| 33 | )] | ||
| 34 | ) | ||
| 35 | |||
| 36 | |||
| 37 | def export() -> Coro: | ||
|  | |||
| 38 | return guild_member_update_middleware | ||
| 39 |