Passed
Pull Request — main (#228)
by
unknown
02:12
created

voice   A

Complexity

Total Complexity 0

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 44
dl 0
loc 82
rs 10
c 0
b 0
f 0
1
"""
2
The MIT License (MIT)
3
Copyright (c) 2015-present Rapptz
4
Permission is hereby granted, free of charge, to any person obtaining a
5
copy of this software and associated documentation files (the "Software"),
6
to deal in the Software without restriction, including without limitation
7
the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
and/or sell copies of the Software, and to permit persons to whom the
9
Software is furnished to do so, subject to the following conditions:
10
The above copyright notice and this permission notice shall be included in
11
all copies or substantial portions of the Software.
12
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
13
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18
DEALINGS IN THE SOFTWARE.
19
"""
20
21
from typing import Optional, TypedDict, List, Literal
22
from .snowflake import Snowflake
23
from .member import MemberWithUser
24
25
26
SupportedModes = Literal['xsalsa20_poly1305_lite', 'xsalsa20_poly1305_suffix', 'xsalsa20_poly1305']
27
28
29
class _PartialVoiceStateOptional(TypedDict, total=False):
30
    member: MemberWithUser
31
    self_stream: bool
32
33
34
class _VoiceState(_PartialVoiceStateOptional):
35
    user_id: Snowflake
36
    session_id: str
37
    deaf: bool
38
    mute: bool
39
    self_deaf: bool
40
    self_mute: bool
41
    self_video: bool
42
    suppress: bool
43
44
45
class GuildVoiceState(_VoiceState):
46
    channel_id: Snowflake
47
48
49
class VoiceState(_VoiceState, total=False):
50
    channel_id: Optional[Snowflake]
51
    guild_id: Snowflake
52
53
54
class VoiceRegion(TypedDict):
55
    id: str
56
    name: str
57
    vip: bool
58
    optimal: bool
59
    deprecated: bool
60
    custom: bool
61
62
63
class VoiceServerUpdate(TypedDict):
64
    token: str
65
    guild_id: Snowflake
66
    endpoint: Optional[str]
67
68
69
class VoiceIdentify(TypedDict):
70
    server_id: Snowflake
71
    user_id: Snowflake
72
    session_id: str
73
    token: str
74
75
76
class VoiceReady(TypedDict):
77
    ssrc: int
78
    ip: str
79
    port: int
80
    modes: List[SupportedModes]
81
    heartbeat_interval: int