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

pincer.middleware.channel_delete   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

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

2 Functions

Rating   Name   Duplication   Size   Complexity  
A export() 0 2 1
A channel_delete_middleware() 0 20 1
1
"""sent when a channel is deleted"""
2
3
from ..core.dispatch import GatewayDispatch
4
from ..objects import Channel
5
from ..utils.conversion import construct_client_dict
6
7
8
async def channel_delete_middleware(self, payload: GatewayDispatch):
9
    """|coro|
10
11
    Middleware for ``on_channel_delete``,
12
13
    Parameters
14
    ----------
15
    self : :class:`Client`
16
        The current client/bot.
17
18
    payload : :class:`pincer.core.dispatch.GatewayDispatch`
19
        The data received from the channel delete event.
20
21
    Returns
22
    -------
23
    Tuple[:class:`str`, `~pincer.objects.guild.channel.Channel`]
24
        ``on_channel_delete`` and a ``Channel``
25
    """
26
    return "on_channel_delete", [
27
        Channel.from_dict(construct_client_dict(self, payload.data))
28
    ]
29
30
31
def export():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
32
    return channel_delete_middleware
33