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 | """sent when a thread is updated""" |
||
5 | |||
6 | from ..core.dispatch import GatewayDispatch |
||
7 | from ..objects import Channel |
||
8 | from ..utils.conversion import construct_client_dict |
||
9 | |||
10 | |||
11 | async def thread_update_middleware(self, payload: GatewayDispatch): |
||
12 | """|coro| |
||
13 | |||
14 | Middleware for ``on_thread_update`` event. |
||
15 | |||
16 | Parameters |
||
17 | ---------- |
||
18 | payload : :class:`GatewayDispatch` |
||
19 | The data received from the thread update event. |
||
20 | |||
21 | |||
22 | Returns |
||
23 | ------- |
||
24 | Tuple[:class:`str`, List[:class:`~pincer.objects.guild.channel.Channel`]] |
||
25 | ``on_thread_update`` and an ``Channel`` |
||
26 | """ |
||
27 | |||
28 | return "on_thread_update", [ |
||
29 | Channel.from_dict(construct_client_dict(self, payload.data)) |
||
30 | ] |
||
31 | |||
32 | |||
33 | def export(): |
||
|
|||
34 | return thread_update_middleware |
||
35 |