Conditions | 2 |
Total Lines | 27 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | # Copyright Pincer 2021-Present |
||
18 | async def guild_update_middleware( |
||
19 | self: Client, gateway: Gateway, payload: GatewayDispatch |
||
20 | ): |
||
21 | """|coro| |
||
22 | |||
23 | Middleware for the ``on_guild_update`` event. |
||
24 | |||
25 | Parameters |
||
26 | ---------- |
||
27 | payload : :class:`~pincer.core.gateway.GatewayDispatch` |
||
28 | The data received from the guild update event. |
||
29 | gateway : :class:`~pincer.core.gateway.Gateway` |
||
30 | The gateway for the current shard. |
||
31 | |||
32 | Returns |
||
33 | ------- |
||
34 | Tuple[:class:`str`, :class:`~pincer.objects.guild.guild.Guild`] |
||
35 | ``on_guild_Update`` and an ``Guild`` |
||
36 | """ |
||
37 | |||
38 | guild = Guild.from_dict(payload.data) |
||
39 | self.guilds[guild.id] = guild |
||
40 | |||
41 | for channel in guild.channels: |
||
42 | self.channels[channel.id] = channel |
||
43 | |||
44 | return "on_guild_update", guild |
||
45 | |||
49 |