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

pincer.middleware.guild_member_add   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_add_middleware() 0 17 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 new user joins a guild. The inner payload is a guild member object
6
with an extra ``guild_id`` key.
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 GuildMemberAddEvent
13
14
15
async def guild_member_add_middleware(self, payload: GatewayDispatch):
16
    """|coro|
17
18
    Middleware for ``on_guild_member_add`` event.
19
20
    Parameters
21
    ----------
22
    self : :class:`Client`
23
        The current client/bot.
24
25
    payload : :class:`GatewayDispatch`
26
        The data received from the guild member add event.
27
    """
28
29
    return "on_guild_member_add", [
30
        GuildMemberAddEvent.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_add_middleware
38