Browse Source

Sync Guild.features to documentation

pull/7197/head
Nadir Chowdhury 4 years ago
committed by GitHub
parent
commit
f14e584304
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 41
      discord/guild.py
  2. 29
      discord/types/guild.py

41
discord/guild.py

@ -81,7 +81,7 @@ MISSING = utils.MISSING
if TYPE_CHECKING: if TYPE_CHECKING:
from .abc import Snowflake, SnowflakeTime from .abc import Snowflake, SnowflakeTime
from .types.guild import Ban as BanPayload, Guild as GuildPayload, MFALevel from .types.guild import Ban as BanPayload, Guild as GuildPayload, MFALevel, GuildFeature
from .types.threads import ( from .types.threads import (
Thread as ThreadPayload, Thread as ThreadPayload,
) )
@ -182,26 +182,33 @@ class Guild(Hashable):
default_notifications: :class:`NotificationLevel` default_notifications: :class:`NotificationLevel`
The guild's notification settings. The guild's notification settings.
features: List[:class:`str`] features: List[:class:`str`]
A list of features that the guild has. They are currently as follows: A list of features that the guild has. The features that a guild can have are
subject to arbitrary change by Discord.
- ``VIP_REGIONS``: Guild has VIP voice regions They are currently as follows:
- ``VANITY_URL``: Guild can have a vanity invite URL (e.g. discord.gg/discord-api)
- ``INVITE_SPLASH``: Guild's invite page can have a special splash. - ``ANIMATED_ICON``: Guild can upload an animated icon.
- ``VERIFIED``: Guild is a verified server. - ``BANNER``: Guild can upload and use a banner. (i.e. :attr:`.banner`)
- ``PARTNERED``: Guild is a partnered server. - ``COMMERCE``: Guild can sell things using store channels.
- ``MORE_EMOJI``: Guild is allowed to have more than 50 custom emoji. - ``COMMUNITY``: Guild is a community server.
- ``DISCOVERABLE``: Guild shows up in Server Discovery. - ``DISCOVERABLE``: Guild shows up in Server Discovery.
- ``FEATURABLE``: Guild is able to be featured in Server Discovery. - ``FEATURABLE``: Guild is able to be featured in Server Discovery.
- ``COMMUNITY``: Guild is a community server. - ``INVITE_SPLASH``: Guild's invite page can have a special splash.
- ``COMMERCE``: Guild can sell things using store channels.
- ``PUBLIC``: Guild is a public guild.
- ``NEWS``: Guild can create news channels.
- ``BANNER``: Guild can upload and use a banner. (i.e. :attr:`.banner`)
- ``ANIMATED_ICON``: Guild can upload an animated icon.
- ``PUBLIC_DISABLED``: Guild cannot be public.
- ``WELCOME_SCREEN_ENABLED``: Guild has enabled the welcome screen
- ``MEMBER_VERIFICATION_GATE_ENABLED``: Guild has Membership Screening enabled. - ``MEMBER_VERIFICATION_GATE_ENABLED``: Guild has Membership Screening enabled.
- ``MONETIZATION_ENABLED``: Guild has enabled monetization.
- ``MORE_EMOJI``: Guild has increased custom emoji slots.
- ``MORE_STICKERS``: Guild has increased custom sticker slots.
- ``NEWS``: Guild can create news channels.
- ``PARTNERED``: Guild is a partnered server.
- ``PREVIEW_ENABLED``: Guild can be viewed before being accepted via Membership Screening. - ``PREVIEW_ENABLED``: Guild can be viewed before being accepted via Membership Screening.
- ``PRIVATE_THREADS``: Guild has access to create private threads.
- ``SEVEN_DAY_THREAD_ARCHIVE``: Guild has access to the seven day archive time for threads.
- ``THREE_DAY_THREAD_ARCHIVE``: Guild has access to the three day archive time for threads.
- ``TICKETED_EVENTS_ENABLED``: Guild has enabled ticketed events.
- ``VANITY_URL``: Guild can have a vanity invite URL (e.g. discord.gg/discord-api).
- ``VERIFIED``: Guild is a verified server.
- ``VIP_REGIONS``: Guild has VIP voice regions.
- ``WELCOME_SCREEN_ENABLED``: Guild has enabled the welcome screen.
premium_tier: :class:`int` premium_tier: :class:`int`
The premium tier for this guild. Corresponds to "Nitro Server" in the official UI. The premium tier for this guild. Corresponds to "Nitro Server" in the official UI.
@ -405,7 +412,7 @@ class Guild(Hashable):
self.mfa_level: MFALevel = guild.get('mfa_level') self.mfa_level: MFALevel = guild.get('mfa_level')
self.emojis: Tuple[Emoji, ...] = tuple(map(lambda d: state.store_emoji(self, d), guild.get('emojis', []))) self.emojis: Tuple[Emoji, ...] = tuple(map(lambda d: state.store_emoji(self, d), guild.get('emojis', [])))
self.features: List[str] = guild.get('features', []) self.features: List[GuildFeature] = guild.get('features', [])
self._splash: Optional[str] = guild.get('splash') self._splash: Optional[str] = guild.get('splash')
self._system_channel_id: Optional[int] = utils._get_as_snowflake(guild, 'system_channel_id') self._system_channel_id: Optional[int] = utils._get_as_snowflake(guild, 'system_channel_id')
self.description: Optional[str] = guild.get('description') self.description: Optional[str] = guild.get('description')

29
discord/types/guild.py

@ -75,21 +75,28 @@ VerificationLevel = Literal[0, 1, 2, 3, 4]
NSFWLevel = Literal[0, 1, 2, 3] NSFWLevel = Literal[0, 1, 2, 3]
PremiumTier = Literal[0, 1, 2, 3] PremiumTier = Literal[0, 1, 2, 3]
GuildFeature = Literal[ GuildFeature = Literal[
'INVITE_SPLASH', 'ANIMATED_ICON',
'VIP_REGIONS', 'BANNER',
'VANITY_URL',
'VERIFIED',
'PARTNERED',
'COMMUNITY',
'COMMERCE', 'COMMERCE',
'NEWS', 'COMMUNITY',
'DISCOVERABLE', 'DISCOVERABLE',
'FEATURABLE', 'FEATURABLE',
'ANIMATED_ICON', 'INVITE_SPLASH',
'BANNER',
'WELCOME_SCREEN_ENABLED',
'MEMBER_VERIFICATION_GATE_ENABLED', 'MEMBER_VERIFICATION_GATE_ENABLED',
'MONETIZATION_ENABLED',
'MORE_EMOJI',
'MORE_STICKERS',
'NEWS',
'PARTNERED',
'PREVIEW_ENABLED', 'PREVIEW_ENABLED',
'PRIVATE_THREADS',
'SEVEN_DAY_THREAD_ARCHIVE',
'THREE_DAY_THREAD_ARCHIVE',
'TICKETED_EVENTS_ENABLED',
'VANITY_URL',
'VERIFIED',
'VIP_REGIONS',
'WELCOME_SCREEN_ENABLED',
] ]
@ -152,8 +159,10 @@ class ChannelPositionUpdate(TypedDict):
lock_permissions: Optional[bool] lock_permissions: Optional[bool]
parent_id: Optional[Snowflake] parent_id: Optional[Snowflake]
class _RolePositionRequired(TypedDict): class _RolePositionRequired(TypedDict):
id: Snowflake id: Snowflake
class RolePositionUpdate(_RolePositionRequired, total=False): class RolePositionUpdate(_RolePositionRequired, total=False):
position: Optional[Snowflake] position: Optional[Snowflake]

Loading…
Cancel
Save