on_message_delete_middleware()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 20
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 20
rs 10
c 0
b 0
f 0
cc 1
nop 3
1
# Copyright Pincer 2021-Present
2
# Full MIT License can be found in `LICENSE` at the project root.
3
4
"""sent when a message is deleted in a subscribed text channel"""
5
from __future__ import annotations
6
7
from typing import TYPE_CHECKING
8
9
from ..objects.events.message import MessageDeleteEvent
10
11
if TYPE_CHECKING:
12
    from typing import Tuple
13
14
    from ..client import Client
15
    from ..core.gateway import Gateway
16
    from ..core.gateway import GatewayDispatch
17
18
19
async def on_message_delete_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
) -> Tuple[str, MessageDeleteEvent]:
22
    """|coro|
23
    Middleware for the ``on_message_delete`` event.
24
25
    Parameters
26
    ----------
27
    payload : :class:`~pincer.core.gateway.GatewayDispatch`
28
        The data received from the message delete event
29
    gateway : :class:`~pincer.core.gateway.Gateway`
30
        The gateway for the current shard.
31
32
    Returns
33
    -------
34
    Tuple[:class:`str`, :class:`~pincer.objects.events.message.MessageDeleteEvent`]
35
        ``on_message_delete`` and a ``MessageDeleteEvent``
36
    """  # noqa: E501
37
38
    return ("on_message_delete", MessageDeleteEvent.from_dict(payload.data))
39
40
41
def export():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
42
    return on_message_delete_middleware
43