mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Remove VoiceRegion enum and Guild.region attribute
This has been marked deprecated by Discord and it was more or less usually out of date due to the pace they added them anyway.
This commit is contained in:
parent
cc21872072
commit
0eb2f32399
@ -228,8 +228,6 @@ class AuditLogChanges:
|
|||||||
'guild_id': ('guild', _transform_guild_id),
|
'guild_id': ('guild', _transform_guild_id),
|
||||||
'tags': ('emoji', None),
|
'tags': ('emoji', None),
|
||||||
'default_message_notifications': ('default_notifications', _enum_transformer(enums.NotificationLevel)),
|
'default_message_notifications': ('default_notifications', _enum_transformer(enums.NotificationLevel)),
|
||||||
'region': (None, _enum_transformer(enums.VoiceRegion)),
|
|
||||||
'rtc_region': (None, _enum_transformer(enums.VoiceRegion)),
|
|
||||||
'video_quality_mode': (None, _enum_transformer(enums.VideoQualityMode)),
|
'video_quality_mode': (None, _enum_transformer(enums.VideoQualityMode)),
|
||||||
'privacy_level': (None, _enum_transformer(enums.StagePrivacyLevel)),
|
'privacy_level': (None, _enum_transformer(enums.StagePrivacyLevel)),
|
||||||
'format_type': (None, _enum_transformer(enums.StickerFormatType)),
|
'format_type': (None, _enum_transformer(enums.StickerFormatType)),
|
||||||
|
@ -46,7 +46,7 @@ import datetime
|
|||||||
|
|
||||||
import discord.abc
|
import discord.abc
|
||||||
from .permissions import PermissionOverwrite, Permissions
|
from .permissions import PermissionOverwrite, Permissions
|
||||||
from .enums import ChannelType, StagePrivacyLevel, try_enum, VoiceRegion, VideoQualityMode
|
from .enums import ChannelType, StagePrivacyLevel, try_enum, VideoQualityMode
|
||||||
from .mixins import Hashable
|
from .mixins import Hashable
|
||||||
from .object import Object
|
from .object import Object
|
||||||
from . import utils
|
from . import utils
|
||||||
@ -879,8 +879,7 @@ class VocalGuildChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hasha
|
|||||||
def _update(self, guild: Guild, data: Union[VoiceChannelPayload, StageChannelPayload]) -> None:
|
def _update(self, guild: Guild, data: Union[VoiceChannelPayload, StageChannelPayload]) -> None:
|
||||||
self.guild = guild
|
self.guild = guild
|
||||||
self.name: str = data['name']
|
self.name: str = data['name']
|
||||||
rtc = data.get('rtc_region')
|
self.rtc_region: Optional[str] = data.get('rtc_region')
|
||||||
self.rtc_region: Optional[VoiceRegion] = try_enum(VoiceRegion, rtc) if rtc is not None else None
|
|
||||||
self.video_quality_mode: VideoQualityMode = try_enum(VideoQualityMode, data.get('video_quality_mode', 1))
|
self.video_quality_mode: VideoQualityMode = try_enum(VideoQualityMode, data.get('video_quality_mode', 1))
|
||||||
self.category_id: Optional[int] = utils._get_as_snowflake(data, 'parent_id')
|
self.category_id: Optional[int] = utils._get_as_snowflake(data, 'parent_id')
|
||||||
self.position: int = data['position']
|
self.position: int = data['position']
|
||||||
@ -978,11 +977,14 @@ class VoiceChannel(VocalGuildChannel):
|
|||||||
The channel's preferred audio bitrate in bits per second.
|
The channel's preferred audio bitrate in bits per second.
|
||||||
user_limit: :class:`int`
|
user_limit: :class:`int`
|
||||||
The channel's limit for number of members that can be in a voice channel.
|
The channel's limit for number of members that can be in a voice channel.
|
||||||
rtc_region: Optional[:class:`VoiceRegion`]
|
rtc_region: Optional[:class:`str`]
|
||||||
The region for the voice channel's voice communication.
|
The region for the voice channel's voice communication.
|
||||||
A value of ``None`` indicates automatic voice region detection.
|
A value of ``None`` indicates automatic voice region detection.
|
||||||
|
|
||||||
.. versionadded:: 1.7
|
.. versionadded:: 1.7
|
||||||
|
|
||||||
|
.. versionchanged:: 2.0
|
||||||
|
The type of this attribute has changed to :class:`str`.
|
||||||
video_quality_mode: :class:`VideoQualityMode`
|
video_quality_mode: :class:`VideoQualityMode`
|
||||||
The camera video quality for the voice channel's participants.
|
The camera video quality for the voice channel's participants.
|
||||||
|
|
||||||
@ -1025,7 +1027,7 @@ class VoiceChannel(VocalGuildChannel):
|
|||||||
sync_permissions: int = ...,
|
sync_permissions: int = ...,
|
||||||
category: Optional[CategoryChannel] = ...,
|
category: Optional[CategoryChannel] = ...,
|
||||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||||
rtc_region: Optional[VoiceRegion] = ...,
|
rtc_region: Optional[str] = ...,
|
||||||
video_quality_mode: VideoQualityMode = ...,
|
video_quality_mode: VideoQualityMode = ...,
|
||||||
reason: Optional[str] = ...,
|
reason: Optional[str] = ...,
|
||||||
) -> Optional[VoiceChannel]:
|
) -> Optional[VoiceChannel]:
|
||||||
@ -1049,6 +1051,9 @@ class VoiceChannel(VocalGuildChannel):
|
|||||||
.. versionchanged:: 2.0
|
.. versionchanged:: 2.0
|
||||||
Edits are no longer in-place, the newly edited channel is returned instead.
|
Edits are no longer in-place, the newly edited channel is returned instead.
|
||||||
|
|
||||||
|
.. versionchanged:: 2.0
|
||||||
|
The ``region`` parameter now accepts :class:`str` instead of an enum.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
name: :class:`str`
|
name: :class:`str`
|
||||||
@ -1070,7 +1075,7 @@ class VoiceChannel(VocalGuildChannel):
|
|||||||
overwrites: :class:`Mapping`
|
overwrites: :class:`Mapping`
|
||||||
A :class:`Mapping` of target (either a role or a member) to
|
A :class:`Mapping` of target (either a role or a member) to
|
||||||
:class:`PermissionOverwrite` to apply to the channel.
|
:class:`PermissionOverwrite` to apply to the channel.
|
||||||
rtc_region: Optional[:class:`VoiceRegion`]
|
rtc_region: Optional[:class:`str`]
|
||||||
The new region for the voice channel's voice communication.
|
The new region for the voice channel's voice communication.
|
||||||
A value of ``None`` indicates automatic voice region detection.
|
A value of ``None`` indicates automatic voice region detection.
|
||||||
|
|
||||||
@ -1144,7 +1149,7 @@ class StageChannel(VocalGuildChannel):
|
|||||||
The channel's preferred audio bitrate in bits per second.
|
The channel's preferred audio bitrate in bits per second.
|
||||||
user_limit: :class:`int`
|
user_limit: :class:`int`
|
||||||
The channel's limit for number of members that can be in a stage channel.
|
The channel's limit for number of members that can be in a stage channel.
|
||||||
rtc_region: Optional[:class:`VoiceRegion`]
|
rtc_region: Optional[:class:`str`]
|
||||||
The region for the stage channel's voice communication.
|
The region for the stage channel's voice communication.
|
||||||
A value of ``None`` indicates automatic voice region detection.
|
A value of ``None`` indicates automatic voice region detection.
|
||||||
video_quality_mode: :class:`VideoQualityMode`
|
video_quality_mode: :class:`VideoQualityMode`
|
||||||
@ -1304,7 +1309,7 @@ class StageChannel(VocalGuildChannel):
|
|||||||
sync_permissions: int = ...,
|
sync_permissions: int = ...,
|
||||||
category: Optional[CategoryChannel] = ...,
|
category: Optional[CategoryChannel] = ...,
|
||||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||||
rtc_region: Optional[VoiceRegion] = ...,
|
rtc_region: Optional[str] = ...,
|
||||||
video_quality_mode: VideoQualityMode = ...,
|
video_quality_mode: VideoQualityMode = ...,
|
||||||
reason: Optional[str] = ...,
|
reason: Optional[str] = ...,
|
||||||
) -> Optional[StageChannel]:
|
) -> Optional[StageChannel]:
|
||||||
@ -1328,6 +1333,9 @@ class StageChannel(VocalGuildChannel):
|
|||||||
.. versionchanged:: 2.0
|
.. versionchanged:: 2.0
|
||||||
Edits are no longer in-place, the newly edited channel is returned instead.
|
Edits are no longer in-place, the newly edited channel is returned instead.
|
||||||
|
|
||||||
|
.. versionchanged:: 2.0
|
||||||
|
The ``region`` parameter now accepts :class:`str` instead of an enum.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
name: :class:`str`
|
name: :class:`str`
|
||||||
@ -1345,7 +1353,7 @@ class StageChannel(VocalGuildChannel):
|
|||||||
overwrites: :class:`Mapping`
|
overwrites: :class:`Mapping`
|
||||||
A :class:`Mapping` of target (either a role or a member) to
|
A :class:`Mapping` of target (either a role or a member) to
|
||||||
:class:`PermissionOverwrite` to apply to the channel.
|
:class:`PermissionOverwrite` to apply to the channel.
|
||||||
rtc_region: Optional[:class:`VoiceRegion`]
|
rtc_region: Optional[:class:`str`]
|
||||||
The new region for the stage channel's voice communication.
|
The new region for the stage channel's voice communication.
|
||||||
A value of ``None`` indicates automatic voice region detection.
|
A value of ``None`` indicates automatic voice region detection.
|
||||||
video_quality_mode: :class:`VideoQualityMode`
|
video_quality_mode: :class:`VideoQualityMode`
|
||||||
|
@ -58,7 +58,7 @@ from .channel import _threaded_channel_factory, PartialMessageable
|
|||||||
from .enums import ChannelType
|
from .enums import ChannelType
|
||||||
from .mentions import AllowedMentions
|
from .mentions import AllowedMentions
|
||||||
from .errors import *
|
from .errors import *
|
||||||
from .enums import Status, VoiceRegion
|
from .enums import Status
|
||||||
from .flags import ApplicationFlags, Intents
|
from .flags import ApplicationFlags, Intents
|
||||||
from .gateway import *
|
from .gateway import *
|
||||||
from .activity import ActivityTypes, BaseActivity, create_activity
|
from .activity import ActivityTypes, BaseActivity, create_activity
|
||||||
@ -1345,7 +1345,6 @@ class Client:
|
|||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
name: str,
|
name: str,
|
||||||
region: Union[VoiceRegion, str] = VoiceRegion.us_west,
|
|
||||||
icon: bytes = MISSING,
|
icon: bytes = MISSING,
|
||||||
code: str = MISSING,
|
code: str = MISSING,
|
||||||
) -> Guild:
|
) -> Guild:
|
||||||
@ -1357,15 +1356,13 @@ class Client:
|
|||||||
|
|
||||||
.. versionchanged:: 2.0
|
.. versionchanged:: 2.0
|
||||||
|
|
||||||
``name`` and ``region``, and ``icon`` parameters are now keyword-only.
|
``name`` and ``icon`` parameters are now keyword-only.
|
||||||
|
The `region`` parameter has been removed.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
name: :class:`str`
|
name: :class:`str`
|
||||||
The name of the guild.
|
The name of the guild.
|
||||||
region: :class:`.VoiceRegion`
|
|
||||||
The region for the voice communication server.
|
|
||||||
Defaults to :attr:`.VoiceRegion.us_west`.
|
|
||||||
icon: Optional[:class:`bytes`]
|
icon: Optional[:class:`bytes`]
|
||||||
The :term:`py:bytes-like object` representing the icon. See :meth:`.ClientUser.edit`
|
The :term:`py:bytes-like object` representing the icon. See :meth:`.ClientUser.edit`
|
||||||
for more details on what is expected.
|
for more details on what is expected.
|
||||||
@ -1392,12 +1389,10 @@ class Client:
|
|||||||
else:
|
else:
|
||||||
icon_base64 = None
|
icon_base64 = None
|
||||||
|
|
||||||
region_value = str(region)
|
|
||||||
|
|
||||||
if code:
|
if code:
|
||||||
data = await self.http.create_from_template(code, name, region_value, icon_base64)
|
data = await self.http.create_from_template(code, name, icon_base64)
|
||||||
else:
|
else:
|
||||||
data = await self.http.create_guild(name, region_value, icon_base64)
|
data = await self.http.create_guild(name, icon_base64)
|
||||||
return Guild(data=data, state=self._connection)
|
return Guild(data=data, state=self._connection)
|
||||||
|
|
||||||
async def fetch_stage_instance(self, channel_id: int, /) -> StageInstance:
|
async def fetch_stage_instance(self, channel_id: int, /) -> StageInstance:
|
||||||
|
@ -30,7 +30,6 @@ __all__ = (
|
|||||||
'Enum',
|
'Enum',
|
||||||
'ChannelType',
|
'ChannelType',
|
||||||
'MessageType',
|
'MessageType',
|
||||||
'VoiceRegion',
|
|
||||||
'SpeakingState',
|
'SpeakingState',
|
||||||
'VerificationLevel',
|
'VerificationLevel',
|
||||||
'ContentFilter',
|
'ContentFilter',
|
||||||
@ -220,35 +219,6 @@ class MessageType(Enum):
|
|||||||
guild_invite_reminder = 22
|
guild_invite_reminder = 22
|
||||||
|
|
||||||
|
|
||||||
class VoiceRegion(Enum):
|
|
||||||
us_west = 'us-west'
|
|
||||||
us_east = 'us-east'
|
|
||||||
us_south = 'us-south'
|
|
||||||
us_central = 'us-central'
|
|
||||||
eu_west = 'eu-west'
|
|
||||||
eu_central = 'eu-central'
|
|
||||||
singapore = 'singapore'
|
|
||||||
london = 'london'
|
|
||||||
sydney = 'sydney'
|
|
||||||
amsterdam = 'amsterdam'
|
|
||||||
frankfurt = 'frankfurt'
|
|
||||||
brazil = 'brazil'
|
|
||||||
hongkong = 'hongkong'
|
|
||||||
russia = 'russia'
|
|
||||||
japan = 'japan'
|
|
||||||
southafrica = 'southafrica'
|
|
||||||
south_korea = 'south-korea'
|
|
||||||
india = 'india'
|
|
||||||
europe = 'europe'
|
|
||||||
dubai = 'dubai'
|
|
||||||
vip_us_east = 'vip-us-east'
|
|
||||||
vip_us_west = 'vip-us-west'
|
|
||||||
vip_amsterdam = 'vip-amsterdam'
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.value
|
|
||||||
|
|
||||||
|
|
||||||
class SpeakingState(Enum):
|
class SpeakingState(Enum):
|
||||||
none = 0
|
none = 0
|
||||||
voice = 1
|
voice = 1
|
||||||
|
@ -59,7 +59,6 @@ from .channel import _threaded_guild_channel_factory
|
|||||||
from .enums import (
|
from .enums import (
|
||||||
AuditLogAction,
|
AuditLogAction,
|
||||||
VideoQualityMode,
|
VideoQualityMode,
|
||||||
VoiceRegion,
|
|
||||||
ChannelType,
|
ChannelType,
|
||||||
try_enum,
|
try_enum,
|
||||||
VerificationLevel,
|
VerificationLevel,
|
||||||
@ -171,9 +170,6 @@ class Guild(Hashable):
|
|||||||
All stickers that the guild owns.
|
All stickers that the guild owns.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. versionadded:: 2.0
|
||||||
region: :class:`VoiceRegion`
|
|
||||||
The region the guild belongs on. There is a chance that the region
|
|
||||||
will be a :class:`str` if the value is not recognised by the enumerator.
|
|
||||||
afk_timeout: :class:`int`
|
afk_timeout: :class:`int`
|
||||||
The timeout to get sent to the AFK channel.
|
The timeout to get sent to the AFK channel.
|
||||||
afk_channel: Optional[:class:`VoiceChannel`]
|
afk_channel: Optional[:class:`VoiceChannel`]
|
||||||
@ -425,7 +421,6 @@ class Guild(Hashable):
|
|||||||
self._member_count: int = member_count
|
self._member_count: int = member_count
|
||||||
|
|
||||||
self.name: str = guild.get('name', '')
|
self.name: str = guild.get('name', '')
|
||||||
self.region: VoiceRegion = try_enum(VoiceRegion, guild.get('region'))
|
|
||||||
self.verification_level: VerificationLevel = try_enum(VerificationLevel, guild.get('verification_level'))
|
self.verification_level: VerificationLevel = try_enum(VerificationLevel, guild.get('verification_level'))
|
||||||
self.default_notifications: NotificationLevel = try_enum(
|
self.default_notifications: NotificationLevel = try_enum(
|
||||||
NotificationLevel, guild.get('default_message_notifications')
|
NotificationLevel, guild.get('default_message_notifications')
|
||||||
@ -1234,7 +1229,7 @@ class Guild(Hashable):
|
|||||||
position: int = MISSING,
|
position: int = MISSING,
|
||||||
bitrate: int = MISSING,
|
bitrate: int = MISSING,
|
||||||
user_limit: int = MISSING,
|
user_limit: int = MISSING,
|
||||||
rtc_region: Optional[VoiceRegion] = MISSING,
|
rtc_region: Optional[str] = MISSING,
|
||||||
video_quality_mode: VideoQualityMode = MISSING,
|
video_quality_mode: VideoQualityMode = MISSING,
|
||||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
|
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||||
) -> VoiceChannel:
|
) -> VoiceChannel:
|
||||||
@ -1261,7 +1256,7 @@ class Guild(Hashable):
|
|||||||
The channel's preferred audio bitrate in bits per second.
|
The channel's preferred audio bitrate in bits per second.
|
||||||
user_limit: :class:`int`
|
user_limit: :class:`int`
|
||||||
The channel's limit for number of members that can be in a voice channel.
|
The channel's limit for number of members that can be in a voice channel.
|
||||||
rtc_region: Optional[:class:`VoiceRegion`]
|
rtc_region: Optional[:class:`str`]
|
||||||
The region for the voice channel's voice communication.
|
The region for the voice channel's voice communication.
|
||||||
A value of ``None`` indicates automatic voice region detection.
|
A value of ``None`` indicates automatic voice region detection.
|
||||||
|
|
||||||
@ -1298,7 +1293,7 @@ class Guild(Hashable):
|
|||||||
options['user_limit'] = user_limit
|
options['user_limit'] = user_limit
|
||||||
|
|
||||||
if rtc_region is not MISSING:
|
if rtc_region is not MISSING:
|
||||||
options['rtc_region'] = None if rtc_region is None else str(rtc_region)
|
options['rtc_region'] = None if rtc_region is None else rtc_region
|
||||||
|
|
||||||
if video_quality_mode is not MISSING:
|
if video_quality_mode is not MISSING:
|
||||||
options['video_quality_mode'] = video_quality_mode.value
|
options['video_quality_mode'] = video_quality_mode.value
|
||||||
@ -1468,7 +1463,6 @@ class Guild(Hashable):
|
|||||||
splash: Optional[bytes] = MISSING,
|
splash: Optional[bytes] = MISSING,
|
||||||
discovery_splash: Optional[bytes] = MISSING,
|
discovery_splash: Optional[bytes] = MISSING,
|
||||||
community: bool = MISSING,
|
community: bool = MISSING,
|
||||||
region: Optional[Union[str, VoiceRegion]] = MISSING,
|
|
||||||
afk_channel: Optional[VoiceChannel] = MISSING,
|
afk_channel: Optional[VoiceChannel] = MISSING,
|
||||||
owner: Snowflake = MISSING,
|
owner: Snowflake = MISSING,
|
||||||
afk_timeout: int = MISSING,
|
afk_timeout: int = MISSING,
|
||||||
@ -1498,6 +1492,9 @@ class Guild(Hashable):
|
|||||||
.. versionchanged:: 2.0
|
.. versionchanged:: 2.0
|
||||||
The newly updated guild is returned.
|
The newly updated guild is returned.
|
||||||
|
|
||||||
|
.. versionchanged:: 2.0
|
||||||
|
The ``region`` keyword parameter has been removed.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
name: :class:`str`
|
name: :class:`str`
|
||||||
@ -1526,8 +1523,6 @@ class Guild(Hashable):
|
|||||||
community: :class:`bool`
|
community: :class:`bool`
|
||||||
Whether the guild should be a Community guild. If set to ``True``\, both ``rules_channel``
|
Whether the guild should be a Community guild. If set to ``True``\, both ``rules_channel``
|
||||||
and ``public_updates_channel`` parameters are required.
|
and ``public_updates_channel`` parameters are required.
|
||||||
region: Union[:class:`str`, :class:`VoiceRegion`]
|
|
||||||
The new region for the guild's voice communication.
|
|
||||||
afk_channel: Optional[:class:`VoiceChannel`]
|
afk_channel: Optional[:class:`VoiceChannel`]
|
||||||
The new channel that is the AFK channel. Could be ``None`` for no AFK channel.
|
The new channel that is the AFK channel. Could be ``None`` for no AFK channel.
|
||||||
afk_timeout: :class:`int`
|
afk_timeout: :class:`int`
|
||||||
@ -1656,9 +1651,6 @@ class Guild(Hashable):
|
|||||||
|
|
||||||
fields['owner_id'] = owner.id
|
fields['owner_id'] = owner.id
|
||||||
|
|
||||||
if region is not MISSING:
|
|
||||||
fields['region'] = str(region)
|
|
||||||
|
|
||||||
if verification_level is not MISSING:
|
if verification_level is not MISSING:
|
||||||
if not isinstance(verification_level, VerificationLevel):
|
if not isinstance(verification_level, VerificationLevel):
|
||||||
raise InvalidArgument('verification_level field must be of type VerificationLevel')
|
raise InvalidArgument('verification_level field must be of type VerificationLevel')
|
||||||
|
@ -26,7 +26,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any, Optional, TYPE_CHECKING
|
from typing import Any, Optional, TYPE_CHECKING
|
||||||
from .utils import parse_time, _get_as_snowflake, _bytes_to_base64_data, MISSING
|
from .utils import parse_time, _get_as_snowflake, _bytes_to_base64_data, MISSING
|
||||||
from .enums import VoiceRegion
|
|
||||||
from .guild import Guild
|
from .guild import Guild
|
||||||
|
|
||||||
# fmt: off
|
# fmt: off
|
||||||
@ -168,20 +167,20 @@ class Template:
|
|||||||
f' creator={self.creator!r} source_guild={self.source_guild!r} is_dirty={self.is_dirty}>'
|
f' creator={self.creator!r} source_guild={self.source_guild!r} is_dirty={self.is_dirty}>'
|
||||||
)
|
)
|
||||||
|
|
||||||
async def create_guild(self, name: str, region: Optional[VoiceRegion] = None, icon: Any = None) -> Guild:
|
async def create_guild(self, name: str, icon: bytes = MISSING) -> Guild:
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
Creates a :class:`.Guild` using the template.
|
Creates a :class:`.Guild` using the template.
|
||||||
|
|
||||||
Bot accounts in more than 10 guilds are not allowed to create guilds.
|
Bot accounts in more than 10 guilds are not allowed to create guilds.
|
||||||
|
|
||||||
|
.. versionchanged:: 2.0
|
||||||
|
The ``region`` parameter has been removed.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
name: :class:`str`
|
name: :class:`str`
|
||||||
The name of the guild.
|
The name of the guild.
|
||||||
region: :class:`.VoiceRegion`
|
|
||||||
The region for the voice communication server.
|
|
||||||
Defaults to :attr:`.VoiceRegion.us_west`.
|
|
||||||
icon: :class:`bytes`
|
icon: :class:`bytes`
|
||||||
The :term:`py:bytes-like object` representing the icon. See :meth:`.ClientUser.edit`
|
The :term:`py:bytes-like object` representing the icon. See :meth:`.ClientUser.edit`
|
||||||
for more details on what is expected.
|
for more details on what is expected.
|
||||||
@ -199,13 +198,11 @@ class Template:
|
|||||||
The guild created. This is not the same guild that is
|
The guild created. This is not the same guild that is
|
||||||
added to cache.
|
added to cache.
|
||||||
"""
|
"""
|
||||||
if icon is not None:
|
base64_icon = None
|
||||||
icon = _bytes_to_base64_data(icon)
|
if icon is not MISSING:
|
||||||
|
base64_icon = _bytes_to_base64_data(icon)
|
||||||
|
|
||||||
region = region or VoiceRegion.us_west
|
data = await self._state.http.create_from_template(self.code, name, base64_icon)
|
||||||
region_value = region.value
|
|
||||||
|
|
||||||
data = await self._state.http.create_from_template(self.code, name, region_value, icon)
|
|
||||||
return Guild(data=data, state=self._state)
|
return Guild(data=data, state=self._state)
|
||||||
|
|
||||||
async def sync(self) -> Template:
|
async def sync(self) -> Template:
|
||||||
|
91
docs/api.rst
91
docs/api.rst
@ -1535,89 +1535,6 @@ of :class:`enum.Enum`.
|
|||||||
|
|
||||||
An alias for :attr:`paragraph`.
|
An alias for :attr:`paragraph`.
|
||||||
|
|
||||||
.. class:: VoiceRegion
|
|
||||||
|
|
||||||
Specifies the region a voice server belongs to.
|
|
||||||
|
|
||||||
.. attribute:: amsterdam
|
|
||||||
|
|
||||||
The Amsterdam region.
|
|
||||||
.. attribute:: brazil
|
|
||||||
|
|
||||||
The Brazil region.
|
|
||||||
.. attribute:: dubai
|
|
||||||
|
|
||||||
The Dubai region.
|
|
||||||
|
|
||||||
.. versionadded:: 1.3
|
|
||||||
|
|
||||||
.. attribute:: eu_central
|
|
||||||
|
|
||||||
The EU Central region.
|
|
||||||
.. attribute:: eu_west
|
|
||||||
|
|
||||||
The EU West region.
|
|
||||||
.. attribute:: europe
|
|
||||||
|
|
||||||
The Europe region.
|
|
||||||
|
|
||||||
.. versionadded:: 1.3
|
|
||||||
|
|
||||||
.. attribute:: frankfurt
|
|
||||||
|
|
||||||
The Frankfurt region.
|
|
||||||
.. attribute:: hongkong
|
|
||||||
|
|
||||||
The Hong Kong region.
|
|
||||||
.. attribute:: india
|
|
||||||
|
|
||||||
The India region.
|
|
||||||
|
|
||||||
.. versionadded:: 1.2
|
|
||||||
|
|
||||||
.. attribute:: japan
|
|
||||||
|
|
||||||
The Japan region.
|
|
||||||
.. attribute:: london
|
|
||||||
|
|
||||||
The London region.
|
|
||||||
.. attribute:: russia
|
|
||||||
|
|
||||||
The Russia region.
|
|
||||||
.. attribute:: singapore
|
|
||||||
|
|
||||||
The Singapore region.
|
|
||||||
.. attribute:: southafrica
|
|
||||||
|
|
||||||
The South Africa region.
|
|
||||||
.. attribute:: south_korea
|
|
||||||
|
|
||||||
The South Korea region.
|
|
||||||
.. attribute:: sydney
|
|
||||||
|
|
||||||
The Sydney region.
|
|
||||||
.. attribute:: us_central
|
|
||||||
|
|
||||||
The US Central region.
|
|
||||||
.. attribute:: us_east
|
|
||||||
|
|
||||||
The US East region.
|
|
||||||
.. attribute:: us_south
|
|
||||||
|
|
||||||
The US South region.
|
|
||||||
.. attribute:: us_west
|
|
||||||
|
|
||||||
The US West region.
|
|
||||||
.. attribute:: vip_amsterdam
|
|
||||||
|
|
||||||
The Amsterdam region for VIP guilds.
|
|
||||||
.. attribute:: vip_us_east
|
|
||||||
|
|
||||||
The US East region for VIP guilds.
|
|
||||||
.. attribute:: vip_us_west
|
|
||||||
|
|
||||||
The US West region for VIP guilds.
|
|
||||||
|
|
||||||
.. class:: VerificationLevel
|
.. class:: VerificationLevel
|
||||||
|
|
||||||
Specifies a :class:`Guild`\'s verification level, which is the criteria in
|
Specifies a :class:`Guild`\'s verification level, which is the criteria in
|
||||||
@ -2937,12 +2854,6 @@ AuditLogDiff
|
|||||||
|
|
||||||
:type: Union[:class:`Member`, :class:`User`]
|
:type: Union[:class:`Member`, :class:`User`]
|
||||||
|
|
||||||
.. attribute:: region
|
|
||||||
|
|
||||||
The guild's voice region. See also :attr:`Guild.region`.
|
|
||||||
|
|
||||||
:type: :class:`VoiceRegion`
|
|
||||||
|
|
||||||
.. attribute:: afk_channel
|
.. attribute:: afk_channel
|
||||||
|
|
||||||
The guild's AFK channel.
|
The guild's AFK channel.
|
||||||
@ -3261,7 +3172,7 @@ AuditLogDiff
|
|||||||
|
|
||||||
See also :attr:`VoiceChannel.rtc_region`.
|
See also :attr:`VoiceChannel.rtc_region`.
|
||||||
|
|
||||||
:type: :class:`VoiceRegion`
|
:type: :class:`str`
|
||||||
|
|
||||||
.. attribute:: video_quality_mode
|
.. attribute:: video_quality_mode
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user