Passed
Pull Request — main (#174)
by
unknown
01:43
created

pincer.middleware.guild_delete   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

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

2 Functions

Rating   Name   Duplication   Size   Complexity  
A guild_delete_middleware() 0 21 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 guild is deleted"""
5
6
from ..core.dispatch import GatewayDispatch
7
from ..objects.guild import UnavailableGuild
8
from ..utils.conversion import construct_client_dict
9
10
11
async def guild_delete_middleware(self, payload: GatewayDispatch):
12
    """|coro|
13
14
    Middleware for ``on_guild_delete`` event.
15
16
    Parameters
17
    ----------
18
    self : :class:`Client`
19
        The current client/bot.
20
21
    payload : :class:`GatewayDispatch`
22
        The data received from the guild delete event.
23
24
    Returns
25
    -------
26
    Tuple[:class:`str`, List[:class:`~pincer.objects.guild.guild.UnavailableGuild`]]
27
        ``on_guild_delete`` and an ``UnavailableGuild``
28
    """
29
30
    return "on_guild_delete", [
31
        UnavailableGuild.from_dict(construct_client_dict(self, payload.data))
32
    ]
33
34
35
def export():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
36
    return guild_delete_middleware
37