Completed
Push — main ( 569940...9b1556 )
by
unknown
26s queued 12s
created

pincer.middleware.channel_create.export()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nop 0
1
# Copyright Pincer 2021-Present
2
# Full MIT License can be found in `LICENSE` at the project root.
3
4
"""Sent when a channel is created/joined on the client."""
5
from ..core.dispatch import GatewayDispatch
6
from ..objects import Channel
7
from ..utils.conversion import construct_client_dict
8
from ..utils.types import Coro
9
10
from typing import TYPE_CHECKING
0 ignored issues
show
introduced by
standard import "from typing import TYPE_CHECKING" should be placed before "from ..core.dispatch import GatewayDispatch"
Loading history...
11
12
from ..utils.conversion import construct_client_dict
0 ignored issues
show
Unused Code introduced by
The import construct_client_dict was already done on line 7. You should be able to
remove this line.
Loading history...
13
from ..objects.guild.channel import Channel
0 ignored issues
show
introduced by
Cannot import 'objects.guild.channel' due to syntax error 'invalid syntax (<unknown>, line 248)'
Loading history...
Bug introduced by
The name channel does not seem to exist in module pincer.objects.guild.
Loading history...
Unused Code introduced by
The import Channel was already done on line 6. You should be able to
remove this line.
Loading history...
14
15
if TYPE_CHECKING:
16
    from typing import List, Tuple
17
18
    from ..core.dispatch import GatewayDispatch
0 ignored issues
show
Unused Code introduced by
The import GatewayDispatch was already done on line 5. You should be able to
remove this line.
Loading history...
19
20
def channel_create_middleware(
21
    self,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
22
    payload: GatewayDispatch
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
23
) -> Tuple[str, List[Channel]]:
0 ignored issues
show
Bug introduced by
The variable Tuple was used before it was assigned.
Loading history...
Bug introduced by
The variable List was used before it was assigned.
Loading history...
24
    """|coro|
25
26
    Middleware for ``on_channel_creation`` event.
27
28
    Parameters
29
    ----------
30
    payload : :class:`~pincer.core.dispatch.GatewayDispatch`
31
        The data received from the ready event.
32
33
    Returns
34
    -------
35
    Tuple[:class:`str`, List[:class:`~pincer.objects.guild.channel.Channel`]]
36
        ``"on_channel_creation"`` and a channel.
37
    """
38
    return "on_channel_creation", [
39
        Channel.from_dict(construct_client_dict(self, payload.data))
40
    ]
41
42
43
def export() -> Coro:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
44
    return channel_create_middleware
45