Conditions | 2 |
Total Lines | 27 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | # Copyright Pincer 2021-Present |
||
19 | async def guild_stickers_update_middleware( |
||
20 | self: Client, gateway: Gateway, payload: GatewayDispatch |
||
21 | ): |
||
22 | """|coro| |
||
23 | |||
24 | Middleware for the ``on_guild_stickers_update`` event. |
||
25 | |||
26 | Parameters |
||
27 | ---------- |
||
28 | payload : :class:`~pincer.core.gateway.GatewayDispatch` |
||
29 | The data received from the guild stickers update event. |
||
30 | gateway : :class:`~pincer.core.gateway.Gateway` |
||
31 | The gateway for the current shard. |
||
32 | |||
33 | Returns |
||
34 | ------- |
||
35 | Tuple[:class:`str`, :class:`~pincer.objects.events.guild.GuildStickersUpdateEvent`] |
||
36 | ``on_guild_sticker_update`` and a ``GuildStickersUpdateEvent`` |
||
37 | """ # noqa: E501 |
||
38 | |||
39 | event = GuildStickersUpdateEvent.from_dict(payload.data) |
||
40 | guild = self.guilds.get(event.guild_id) |
||
41 | |||
42 | if guild: |
||
43 | guild.stickers = event.stickers |
||
44 | |||
45 | return ("on_guild_stickers_update", event) |
||
46 | |||
50 |