aboutsummaryrefslogtreecommitdiff
path: root/discord
diff options
context:
space:
mode:
Diffstat (limited to 'discord')
-rw-r--r--discord/abc.py7
-rw-r--r--discord/channel.py19
-rw-r--r--discord/guild.py7
-rw-r--r--discord/http.py6
4 files changed, 34 insertions, 5 deletions
diff --git a/discord/abc.py b/discord/abc.py
index 78dab420..54cb6e80 100644
--- a/discord/abc.py
+++ b/discord/abc.py
@@ -257,6 +257,13 @@ class GuildChannel:
except KeyError:
pass
+ try:
+ rtc_region = options.pop('rtc_region')
+ except KeyError:
+ pass
+ else:
+ options['rtc_region'] = None if rtc_region is None else str(rtc_region)
+
lock_permissions = options.pop('sync_permissions', False)
try:
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
------
diff --git a/discord/guild.py b/discord/guild.py
index eddffdc4..c9f47db4 100644
--- a/discord/guild.py
+++ b/discord/guild.py
@@ -844,6 +844,13 @@ class Guild(Hashable):
except KeyError:
pass
+ try:
+ rtc_region = options.pop('rtc_region')
+ except KeyError:
+ pass
+ else:
+ options['rtc_region'] = None if rtc_region is None else str(rtc_region)
+
parent_id = category.id if category else None
return self._state.http.create_channel(self.id, channel_type.value, name=name, parent_id=parent_id,
permission_overwrites=perms, **options)
diff --git a/discord/http.py b/discord/http.py
index 1d0b2628..9a95c65a 100644
--- a/discord/http.py
+++ b/discord/http.py
@@ -584,11 +584,10 @@ class HTTPClient:
r = Route('PATCH', '/channels/{channel_id}', channel_id=channel_id)
valid_keys = ('name', 'parent_id', 'topic', 'bitrate', 'nsfw',
'user_limit', 'position', 'permission_overwrites', 'rate_limit_per_user',
- 'type')
+ 'type', 'rtc_region')
payload = {
k: v for k, v in options.items() if k in valid_keys
}
-
return self.request(r, reason=reason, json=payload)
def bulk_channel_update(self, guild_id, data, *, reason=None):
@@ -601,7 +600,8 @@ class HTTPClient:
}
valid_keys = ('name', 'parent_id', 'topic', 'bitrate', 'nsfw',
- 'user_limit', 'position', 'permission_overwrites', 'rate_limit_per_user')
+ 'user_limit', 'position', 'permission_overwrites', 'rate_limit_per_user',
+ 'rtc_region')
payload.update({
k: v for k, v in options.items() if k in valid_keys and v is not None
})