aboutsummaryrefslogtreecommitdiff
path: root/discord/channel.py
diff options
context:
space:
mode:
authorTarek <[email protected]>2021-04-01 09:49:45 +0200
committerGitHub <[email protected]>2021-04-01 03:49:45 -0400
commit6524869ddd283a1704d0eec9bc87b2663c247d01 (patch)
treece3794ede46b31a0155146f0e9d646bf2afe3f2b /discord/channel.py
parentAdd support for Permissions.request_to_speak (diff)
downloaddiscord.py-6524869ddd283a1704d0eec9bc87b2663c247d01.tar.xz
discord.py-6524869ddd283a1704d0eec9bc87b2663c247d01.zip
Implement voice region changing for voice channels
Diffstat (limited to 'discord/channel.py')
-rw-r--r--discord/channel.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/discord/channel.py b/discord/channel.py
index 9d3b200c..79441c96 100644
--- a/discord/channel.py
+++ b/discord/channel.py
@@ -29,7 +29,7 @@ import asyncio
import discord.abc
from .permissions import Permissions
-from .enums import ChannelType, try_enum
+from .enums import ChannelType, try_enum, VoiceRegion
from .mixins import Hashable
from . import utils
from .asset import Asset
@@ -575,10 +575,16 @@ class VoiceChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable):
The channel's preferred audio bitrate in bits per second.
user_limit: :class:`int`
The channel's limit for number of members that can be in a voice channel.
+ rtc_region: Optional[:class:`VoiceRegion`]
+ The region for the voice channel's voice communication.
+ A value of ``None`` indicates automatic voice region detection.
+
+ .. versionadded:: 1.7
"""
__slots__ = ('name', 'id', 'guild', 'bitrate', 'user_limit',
- '_state', 'position', '_overwrites', 'category_id')
+ '_state', 'position', '_overwrites', 'category_id',
+ 'rtc_region')
def __init__(self, *, state, guild, data):
self._state = state
@@ -589,6 +595,7 @@ class VoiceChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable):
attrs = [
('id', self.id),
('name', self.name),
+ ('rtc_region', self.rtc_region),
('position', self.position),
('bitrate', self.bitrate),
('user_limit', self.user_limit),
@@ -610,6 +617,9 @@ class VoiceChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable):
def _update(self, guild, data):
self.guild = guild
self.name = data['name']
+ self.rtc_region = data.get('rtc_region')
+ if self.rtc_region:
+ self.rtc_region = try_enum(VoiceRegion, self.rtc_region)
self.category_id = utils._get_as_snowflake(data, 'parent_id')
self.position = data['position']
self.bitrate = data.get('bitrate')
@@ -700,6 +710,11 @@ class VoiceChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable):
overwrites: :class:`dict`
A :class:`dict` of target (either a role or a member) to
:class:`PermissionOverwrite` to apply to the channel.
+ rtc_region: Optional[:class:`VoiceRegion`]
+ The new region for the voice channel's voice communication.
+ A value of ``None`` indicates automatic voice region detection.
+
+ .. versionadded:: 1.7
Raises
------