pincer.middleware.integration_create   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

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

2 Functions

Rating   Name   Duplication   Size   Complexity  
A export() 0 2 1
A integration_create_middleware() 0 22 1
1
# Copyright Pincer 2021-Present
2
# Full MIT License can be found in `LICENSE` at the project root.
3
4
"""sent when an integration is created"""
5
6
from __future__ import annotations
7
8
from typing import TYPE_CHECKING
9
10
from ..objects.events.integration import IntegrationCreateEvent
11
from ..utils.types import Coro
12
13
if TYPE_CHECKING:
14
    from ..client import Client
15
    from ..core.gateway import Gateway
16
    from ..core.gateway import GatewayDispatch
17
18
19
async def integration_create_middleware(
20
    self: Client, gateway: Gateway, payload: GatewayDispatch
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument gateway seems to be unused.
Loading history...
Unused Code introduced by
The argument self seems to be unused.
Loading history...
21
):
22
    """|coro|
23
24
    Middleware for the ``on_integration_create`` event.
25
26
    Parameters
27
    ----------
28
    payload : :class:`~pincer.core.gateway.GatewayDispatch`
29
        The data received from the integration create event
30
    gateway : :class:`~pincer.core.gateway.Gateway`
31
        The gateway for the current shard.
32
33
    Returns
34
    -------
35
    Tuple[:class:`str`, :class:`~pincer.events.integration.IntegrationCreateEvent`]
36
        ``on_integration_create`` and an ``IntegrationCreateEvent``
37
    """  # noqa: E501
38
    return (
39
        "on_integration_create",
40
        IntegrationCreateEvent.from_dict(payload.data),
41
    )
42
43
44
def export() -> Coro:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
45
    return integration_create_middleware
46