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

pincer.middleware.guild_member_remove   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

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

2 Functions

Rating   Name   Duplication   Size   Complexity  
A export() 0 2 1
A guild_member_remove_middleware() 0 18 1
1
# Copyright Pincer 2021-Present
2
# Full MIT License can be found in `LICENSE` at the project root.
3
4
"""
5
Sent when a user is removed from a guild (leave/kick/ban).
6
"""
7
8
from ..core.dispatch import GatewayDispatch
9
from ..utils import Coro
10
from ..utils.conversion import construct_client_dict
11
from ..objects.events.guild import GuildMemberRemoveEvent
12
13
14
async def guild_member_remove_middleware(self, payload: GatewayDispatch):
15
    """|coro|
16
17
    Middleware for ``on_guild_member_remove`` event.
18
19
    Parameters
20
    ----------
21
    self : :class:`Client`
22
        The current client/bot.
23
24
    payload : :class:`GatewayDispatch`
25
        The data received from the guild member remove event.
26
    """
27
28
    return (
29
        "on_guild_member_remove",
30
        [GuildMemberRemoveEvent.from_dict(
31
            construct_client_dict(self, payload.data)
32
        )]
33
    )
34
35
36
def export() -> Coro:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
37
    return guild_member_remove_middleware
38