-
Notifications
You must be signed in to change notification settings - Fork 134
/
voice_region.py
52 lines (39 loc) · 1.29 KB
/
voice_region.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# SPDX-License-Identifier: MIT
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from .types.voice import VoiceRegion as VoiceRegionPayload
__all__ = ("VoiceRegion",)
class VoiceRegion:
"""Represents a Discord voice region.
.. versionadded:: 2.5
Attributes
----------
id: :class:`str`
Unique ID for the region.
name: :class:`str`
The name of the region.
optimal: :class:`bool`
True for a single region that is closest to your client.
deprecated: :class:`bool`
Whether this is a deprecated voice region (avoid switching to these).
custom: :class:`bool`
Whether this is a custom voice region (used for events/etc)
"""
__slots__ = (
"id",
"name",
"optimal",
"deprecated",
"custom",
)
def __init__(self, *, data: VoiceRegionPayload):
self.id: str = data["id"]
self.name: str = data["name"]
self.deprecated: bool = data.get("deprecated", False)
self.optimal: bool = data.get("optimal", False)
self.custom: bool = data.get("custom", False)
def __str__(self):
return self.id
def __repr__(self):
return f"<VoiceRegion id={self.id!r} name={self.name!r} optimal={self.optimal!r}>"