Passed
Pull Request — main (#174)
by
unknown
01:46
created

thread_create_middleware()   A

Complexity

Conditions 1

Size

Total Lines 18
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 18
rs 10
c 0
b 0
f 0
cc 1
nop 2
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 created/joined on the client."""
5
6
from ..core.dispatch import GatewayDispatch
7
from ..objects import Channel
8
from ..utils.conversion import construct_client_dict
9
10
11
def thread_create_middleware(self, payload: GatewayDispatch):
12
    """|coro|
13
14
    Middleware for ``on_thread_create`` event.
15
16
    Parameters
17
    ----------
18
    payload : :class:`GatewayDispatch`
19
        The data received from the thread create event.
20
21
    Returns
22
    -------
23
    Tuple[:class:`str`, List[:class:`~pincer.objects.guild.channel.Channel`]]
24
        ``on_thread_create`` and an ``Channel``
25
    """
26
27
    return "on_thread_create", [
28
        Channel.from_dict(construct_client_dict(self, payload.data))
29
    ]
30
31
32
def export():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
33
    return thread_create_middleware
34