Passed
Pull Request — main (#163)
by
unknown
01:39
created

pincer.middleware.thread_create   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 10
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A export() 0 2 1
A thread_create_middleware() 0 12 1
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
    """
13
    Middleware for ``on_thread_create`` event.
14
15
    :param self:
16
        The current client
17
18
    :param payload:
19
        The data received from the thread create event.
20
    """
21
    return "on_thread_create", [
22
        Channel.from_dict(construct_client_dict(self, payload.data))
23
    ]
24
25
26
def export():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
27
    return thread_create_middleware
28