1
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
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 |
|
|
|
|
32
|
|
|
from pincer.utils.types import APINullable, MISSING |
33
|
|
|
|
34
|
|
|
|
35
|
|
|
@dataclass |
|
|
|
|
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
|
|
|
|