Passed
Push — main ( 8be509...207edf )
by
unknown
01:42
created

pincer.objects.events.invite   A

Complexity

Total Complexity 0

Size/Duplication

Total Lines 111
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 26
dl 0
loc 111
rs 10
c 0
b 0
f 0
1
# -*- coding: utf-8 -*-
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
# MIT License
3
#
4
# Copyright (c) 2021 Pincer
5
#
6
# Permission is hereby granted, free of charge, to any person obtaining
7
# a copy of this software and associated documentation files
8
# (the "Software"), to deal in the Software without restriction,
9
# including without limitation the rights to use, copy, modify, merge,
10
# publish, distribute, sublicense, and/or sell copies of the Software,
11
# and to permit persons to whom the Software is furnished to do so,
12
# subject to the following conditions:
13
#
14
# The above copyright notice and this permission notice shall be
15
# included in all copies or substantial portions of the Software.
16
#
17
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
25
from dataclasses import dataclass
26
27
from pincer.objects.invite import InviteTargetType
28
from pincer.objects.user import User
29
from pincer.utils.api_object import APIObject
30
from pincer.utils.snowflake import Snowflake
31
from pincer.utils.timestamp import Timestamp
0 ignored issues
show
introduced by
Cannot import 'pincer.utils.timestamp' due to syntax error 'invalid syntax (<unknown>, line 91)'
Loading history...
Bug introduced by
The name timestamp does not seem to exist in module pincer.utils.
Loading history...
32
from pincer.utils.types import APINullable, MISSING
33
34
35
@dataclass
0 ignored issues
show
best-practice introduced by
Too many instance attributes (11/7)
Loading history...
36
class InviteCreateEvent(APIObject):
37
    """
38
    Sent when a new invite to a channel is created.
39
40
    :param channel_id:
41
        the channel the invite is for
42
43
    :param code:
44
        the unique invite code
45
46
    :param created_at:
47
        the time at which the invite was created
48
49
    :param guild_id:
50
        the guild of the invite
51
52
    :param inviter:
53
        the user that created the invite
54
55
    :param max_age:
56
        how long the invite is valid for (in seconds)
57
58
    :param max_uses:
59
        the maximum number of times the invite can be used
60
61
    :param target_type:
62
        the type of target for this voice channel invite
63
64
    :param target_user:
65
        the user whose stream to display for
66
        this voice channel stream invite
67
68
    :param target_application:
69
        the embedded application to open for this
70
        voice channel embedded application invite
71
72
    :param temporary:
73
        whether or not the invite is temporary (invited users will
74
        be kicked on disconnect unless they're assigned a role)
75
76
    :param uses:
77
        how many times the invite has been used (always will be 0)
78
    """
79
    channel_id: Snowflake
80
    code: str
81
    created_at: Timestamp
82
    max_age: int
83
    max_uses: int
84
    temporary: bool
85
86
    guild_id: APINullable[Snowflake] = MISSING
87
    inviter: APINullable[User] = MISSING
88
    target_type: APINullable[InviteTargetType] = MISSING
89
    target_user: APINullable[User] = MISSING
90
    uses: int = 0
91
92
93
@dataclass
94
class InviteDeleteEvent(APIObject):
95
    """
96
    Sent when an invite is deleted.
97
98
    :param channel_id:
99
        the channel of the invite
100
101
    :param guild_id:
102
        the guild of the invite
103
104
    :param code:
105
        the unique invite code
106
    """
107
    channel_id: Snowflake
108
    code: str
109
110
    guild_id: APINullable[Snowflake] = MISSING
111