Passed
Pull Request — main (#162)
by
unknown
01:25
created

pincer.middleware.guild_members_chunk   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

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

2 Functions

Rating   Name   Duplication   Size   Complexity  
A export() 0 2 1
A guild_member_chunk_middleware() 0 15 1
1
# Copyright Pincer 2021-Present
2
# Full MIT License can be found in `LICENSE` at the project root.
3
4
"""
5
Sent in response to Guild Request Members. You can use the ``chunk_index``
6
and ``chunk_count`` to calculate how many chunks are left for your request.
7
"""
8
9
from ..core.dispatch import GatewayDispatch
10
from ..utils import Coro
11
from ..utils.conversion import construct_client_dict
12
from ..objects.events.guild import GuildMembersChunkEvent
13
14
15
async def guild_member_chunk_middleware(self, payload: GatewayDispatch):
16
    """
17
    Middleware for ``on_guild_member_chunk`` event.
18
19
    :param self:
20
        The current client/bot.
21
22
    :param payload:
23
        The data received from the event.
24
    """
25
26
    return (
27
        "on_guild_member_chunk",
28
        [GuildMembersChunkEvent.from_dict(
29
            construct_client_dict(self, payload.data)
30
        )]
31
    )
32
33
34
def export() -> Coro:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
35
    return guild_member_chunk_middleware
36