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

channel_delete_middleware()   A

Complexity

Conditions 1

Size

Total Lines 20
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 20
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 channel 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 channel_delete_middleware(self, payload: GatewayDispatch):
12
    """|coro|
13
14
    Middleware for ``on_channel_delete``,
15
16
    Parameters
17
    ----------
18
    self : :class:`Client`
19
        The current client/bot.
20
21
    payload : :class:`pincer.core.dispatch.GatewayDispatch`
22
        The data received from the channel delete event.
23
24
    Returns
25
    -------
26
    Tuple[:class:`str`, `~pincer.objects.guild.channel.Channel`]
27
        ``on_channel_delete`` and a ``Channel``
28
    """
29
    return "on_channel_delete", [
30
        Channel.from_dict(construct_client_dict(self, payload.data))
31
    ]
32
33
34
def export():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
35
    return channel_delete_middleware
36