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

pincer.middleware.channel_update   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

2 Functions

Rating   Name   Duplication   Size   Complexity  
A channel_update_middleware() 0 13 1
A export() 0 2 1
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 updated"""
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_update_middleware(self, payload: GatewayDispatch):
12
    """
13
    Middleware for ``on_channel_update``,
14
        creates a object for the channel that is updated
15
16
    :param self:
17
        The current client.
18
19
    :param payload:
20
        The data received from the channel update event.
21
    """
22
    return "on_channel_update", [
23
       Channel.from_dict(construct_client_dict(self, payload.data))
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 1 space).
Loading history...
24
    ]
25
26
27
def export():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
28
    return channel_update_middleware
29