pincer.middleware.webhooks_update   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

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

2 Functions

Rating   Name   Duplication   Size   Complexity  
A export() 0 2 1
A webhooks_update_middleware() 0 20 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's voice state changes in a subscribed voice channel
6
(mute, volume, etc.)
7
"""
8
9
from __future__ import annotations
10
11
from typing import TYPE_CHECKING
12
13
from ..objects.events.webhook import WebhooksUpdateEvent
14
15
if TYPE_CHECKING:
16
    from ..client import Client
17
    from ..core.gateway import Gateway
18
    from ..core.gateway import GatewayDispatch
19
20
21
async def webhooks_update_middleware(
22
    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...
23
):
24
    """|coro|
25
26
    Middleware for the ``on_webhooks_update`` event.
27
28
    Parameters
29
    ----------
30
    payload : :class:`~pincer.core.gateway.GatewayDispatch`
31
        The data received from the webhooks update event.
32
    gateway : :class:`~pincer.core.gateway.Gateway`
33
        The gateway for the current shard.
34
35
    Returns
36
    -------
37
    Tuple[:class:`str`, :class:`~pincer.objects.events.webhook.WebhooksUpdateEvent`]
38
        ``on_webhooks_update`` and a ``WebhooksUpdateEvent``
39
    """  # noqa: E501
40
    return ("on_webhooks_update", WebhooksUpdateEvent.from_dict(payload.data))
41
42
43
def export():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
44
    return webhooks_update_middleware
45