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 | """sent when a thread is deleted""" |
||
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_delete_middleware(self, payload: GatewayDispatch): |
||
12 | """|coro| |
||
13 | |||
14 | Middleware for ``on_thread_delete`` event. |
||
15 | |||
16 | Parameters |
||
17 | ---------- |
||
18 | self : :class:`Client` |
||
19 | The current client/bot. |
||
20 | |||
21 | payload : :class:`GatewayDispatch` |
||
22 | The data received from the thread delete event. |
||
23 | |||
24 | |||
25 | Returns |
||
26 | ------- |
||
27 | Tuple[:class:`str`, List[:class:`~pincer.objects.guild.channel.Channel`]] |
||
28 | ``on_thread_delete`` and an ``Channel`` |
||
29 | """ |
||
30 | |||
31 | return "on_thread_delete", [ |
||
32 | Channel.from_dict(construct_client_dict(self, payload.data)) |
||
33 | ] |
||
34 | |||
35 | |||
36 | def export(): |
||
|
|||
37 | return thread_delete_middleware |
||
38 |