pincer.middleware.activity_join   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

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

2 Functions

Rating   Name   Duplication   Size   Complexity  
A activity_join_middleware() 0 22 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
"""
5
Sent when the user clicks a Rich Presence join invite in chat
6
to join a game.
7
"""
8
9
from __future__ import annotations
10
11
from typing import TYPE_CHECKING
12
13
from ..objects.events.activity import ActivityJoinEvent
14
from ..utils.types import Coro
15
16
if TYPE_CHECKING:
17
    from ..client import Client
18
    from ..core.gateway import Gateway
19
    from ..core.gateway import GatewayDispatch
20
21
22
async def activity_join_middleware(
23
    self: Client, gateway: Gateway, payload: GatewayDispatch
0 ignored issues
show
Unused Code introduced by
The argument gateway seems to be unused.
Loading history...
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
Unused Code introduced by
The argument self seems to be unused.
Loading history...
24
):
25
    """|coro|
26
27
    Middleware for the ``on_activity_join`` event.
28
29
    Parameters
30
    ----------
31
    payload : :class:`~pincer.core.gateway.GatewayDispatch`
32
        The data received from the activity join event.
33
    gateway : :class:`~pincer.core.gateway.Gateway`
34
        The gateway for the current shard.
35
36
    Returns
37
    -------
38
    Tuple[:class:`str`, :class:`~pincer.objects.events.activity.ActivityJoinEvent`]
39
        ``on_activity_join`` and an ``ActivityJoinEvent``
40
    """  # noqa: E501
41
    return (
42
        "on_activity_join",
43
        ActivityJoinEvent.from_dict(payload.data),
44
    )
45
46
47
def export() -> Coro:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
48
    return activity_join_middleware
49