pep-8, update docs, update docstrings, do some flake8 checks and fixes

This commit is contained in:
grey-cat-1908 2022-03-21 23:01:54 +03:00
parent abce5e9116
commit d3cda4069f
3 changed files with 92 additions and 76 deletions

View file

@ -4,4 +4,5 @@ Melisa Models
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
user user
guild

View file

@ -14,7 +14,7 @@ from ...utils.types import APINullable
class DefaultMessageNotificationLevel(IntEnum): class DefaultMessageNotificationLevel(IntEnum):
"""Message notification level """Message notification level
Attributes Attributes
---------- ----------
ALL_MESSAGES: ALL_MESSAGES:
@ -53,7 +53,7 @@ class ExplicitContentFilterLevel(IntEnum):
class MFALevel(IntEnum): class MFALevel(IntEnum):
"""MFA Level """MFA Level
Attributes Attributes
---------- ----------
NONE: NONE:
@ -174,49 +174,50 @@ class GuildFeatures(Enum):
Attributes Attributes
---------- ----------
ANIMATED_ICON: ANIMATED_ICON:
Guild has access to set an animated guild icon Guild has access to set an animated guild icon
BANNER: BANNER:
Guild has access to set a guild banner image Guild has access to set a guild banner image
COMMERCE: COMMERCE:
Guild has access to use commerce features (i.e. create store channels) Guild has access to use commerce features (i.e. create store channels)
COMMUNITY: COMMUNITY:
Guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates Guild can enable welcome screen, Membership Screening,
stage channels and discovery, and receives community updates
DISCOVERABLE: DISCOVERABLE:
Guild is able to be discovered in the directory Guild is able to be discovered in the directory
FEATURABLE: FEATURABLE:
Guild is able to be featured in the directory Guild is able to be featured in the directory
INVITE_SPLASH: INVITE_SPLASH:
Guild has access to set an invite splash background Guild has access to set an invite splash background
MEMBER_VERIFICATION_GATE_ENABLED: MEMBER_VERIFICATION_GATE_ENABLED:
Guild has enabled Membership Screening Guild has enabled Membership Screening
MONETIZATION_ENABLED: MONETIZATION_ENABLED:
Guild has enabled monetization Guild has enabled monetization
MORE_STICKERS: MORE_STICKERS:
Guild has increased custom sticker slots Guild has increased custom sticker slots
NEWS: NEWS:
Guild has access to create news channels Guild has access to create news channels
PARTNERED: PARTNERED:
Guild is partnered Guild is partnered
PREVIEW_ENABLED: PREVIEW_ENABLED:
Guild can be previewed before joining via Membership Screening or the directory Guild can be previewed before joining via Membership Screening or the directory
PRIVATE_THREADS: PRIVATE_THREADS:
Guild has access to create private threads Guild has access to create private threads
ROLE_ICONS: ROLE_ICONS:
Guild is able to set role icons Guild is able to set role icons
SEVEN_DAY_THREAD_ARCHIVE: SEVEN_DAY_THREAD_ARCHIVE:
Guild has access to the seven day archive time for threads Guild has access to the seven day archive time for threads
THREE_DAY_THREAD_ARCHIVE: THREE_DAY_THREAD_ARCHIVE:
Guild has access to the three day archive time for threads Guild has access to the three day archive time for threads
TICKETED_EVENTS_ENABLED: TICKETED_EVENTS_ENABLED:
Guild has enabled ticketed events Guild has enabled ticketed events
VANITY_URL: VANITY_URL:
Guild has access to set a vanity URL Guild has access to set a vanity URL
VERIFIED: VERIFIED:
Guild is verified Guild is verified
VIP_REGIONS: VIP_REGIONS:
Guild has access to set 384kbps bitrate in voice (previously VIP voice servers) Guild has access to set 384kbps bitrate in voice (previously VIP voice servers)
WELCOME_SCREEN_ENABLED: WELCOME_SCREEN_ENABLED:
Guild has enabled the welcome screen Guild has enabled the welcome screen
""" """
ANIMATED_ICON = "ANIMATED_ICON" ANIMATED_ICON = "ANIMATED_ICON"
@ -245,8 +246,9 @@ class GuildFeatures(Enum):
@dataclass(repr=False) @dataclass(repr=False)
class Guild(APIModelBase): class Guild(APIModelBase):
"""Guilds in Discord represent an isolated collection of users and channels, and are often referred to as "servers" in the UI. """Guilds in Discord represent an isolated collection of users and channels,
and are often referred to as "servers" in the UI.
Attributes Attributes
---------- ----------
id: :class:`~melisa.utils.types.Snowflake` id: :class:`~melisa.utils.types.Snowflake`
@ -255,21 +257,21 @@ class Guild(APIModelBase):
Guild name (2-100 characters, excluding trailing and leading whitespace) Guild name (2-100 characters, excluding trailing and leading whitespace)
icon: :class:`str` icon: :class:`str`
Icon hash Icon hash
icon_hash: :class:`str` icon_hash: Optional[:class:`str`]
Icon hash, returned when in the template object Icon hash, returned when in the template object
splash: :class:`str` splash: Optional[:class:`str`]
Splash hash Splash hash
discovery_splash: :class:`str` discovery_splash: Optional[:class:`str`]
Discovery splash hash; only present for guilds with the "DISCOVERABLE" feature Discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
owner: :class:`bool` owner: :class:`bool`
True if the user is the owner of the guild True if the user is the owner of the guild
owner_id: :class:`~melisa.utils.types.Snowflake` owner_id: Optional[:class:`~melisa.utils.types.Snowflake`]
Id of owner Id of owner
permissions: :class:`str` permissions: Optional[:class:`str`]
Total permissions for the user in the guild (excludes overwrites) Total permissions for the user in the guild (excludes overwrites)
region: :class:`str` region: Optional[:class:`str`]
Voice region id for the guild (deprecated) Voice region id for the guild (deprecated)
afk_channel_id: :class:`~melisa.utils.types.Snowflake` afk_channel_id: Optional[:class:`~melisa.utils.types.Snowflake`]
Id of afk channel Id of afk channel
afk_timeout: :class:`int` afk_timeout: :class:`int`
Afk timeout in seconds Afk timeout in seconds
@ -279,79 +281,89 @@ class Guild(APIModelBase):
The channel id that the widget will generate an invite to, or `null` if set to no invite The channel id that the widget will generate an invite to, or `null` if set to no invite
verification_level: :class:`int` verification_level: :class:`int`
Verification level required for the guild Verification level required for the guild
default_message_notifications: :class:`int` default_message_notifications: Optional[:class:`int`]
Default message notifications level Default message notifications level
explicit_content_filter: :class:`int` explicit_content_filter: :class:`int`
Explicit content filter level Explicit content filter level
features: features: Optional[:class:`typing.Any`]
Enabled guild features Enabled guild features
roles: roles: Optional[:class:`typing.Any`]
Roles in the guild Roles in the guild
emojis: emojis: Optional[:class:`typing.Any`]
Custom guild emojis Custom guild emojis
mfa_level: :class:`int` mfa_level: :class:`int`
Required MFA level for the guild Required MFA level for the guild
application_id: :class:`~melisa.utils.types.Snowflake` application_id: Optional[:class:`~melisa.utils.types.Snowflake`]
Application id of the guild creator if it is bot-created Application id of the guild creator if it is bot-created
system_channel_id: :class:`~melisa.utils.types.Snowflake` system_channel_id: Optional[:class:`~melisa.utils.types.Snowflake`]
The id of the channel where guild notices such as welcome messages and boost events are posted The id of the channel where guild notices
such as welcome messages and boost events are posted
system_channel_flags: :class:`int` system_channel_flags: :class:`int`
System channel flags System channel flags
rules_channel_id: :class:`~melisa.utils.types.Snowflake` rules_channel_id: Optional[:class:`~melisa.utils.types.Snowflake`]
The id of the channel where Community guilds can display rules and/or guidelines The id of the channel where Community guilds can display rules and/or guidelines
joined_at: :class:`int` joined_at: Optional[:class:`int`]
When this guild was joined at When this guild was joined at
large: :class:`bool` large: Optional[:class:`bool`]
True if this is considered a large guild True if this is considered a large guild
unavailable: :class:`bool` unavailable: :class:`bool`
True if this guild is unavailable due to an outage True if this guild is unavailable due to an outage
member_count: :class:`int` member_count: Optional[:class:`int`]
Total number of members in this guild Total number of members in this guild
voice_states: voice_states:
States of members currently in voice channels; lacks the `guild_id` key States of members currently in voice channels; lacks the `guild_id` key
members: members: Optional[:class:`typing.Any`]
Users in the guild Users in the guild
channels: channels: Optional[:class:`typing.Any`]
Channels in the guild Channels in the guild
threads: threads: Optional[:class:`typing.Any`]
All active threads in the guild that current user has permission to view All active threads in the guild that current user has permission to view
presences: presences: Optional[:class:`typing.Any`]
Presences of the members in the guild, will only include non-offline members if the size is greater than `large threshold` Presences of the members in the guild, will only include non-offline members
max_presences: :class:`int` if the size is greater than `large threshold`
The maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds) max_presences: Optional[:class:`int`]
max_members: :class:`int` The maximum number of presences for the guild
(`null` is always returned, apart from the largest of guilds)
max_members: Optional[:class:`int`]
The maximum number of members for the guild The maximum number of members for the guild
vanity_url_code: :class:`str` vanity_url_code: Optional[:class:`str`]
The vanity url code for the guild The vanity url code for the guild
description: :class:`str` description: Optional[:class:`str`]
The description of a Community guild The description of a Community guild
banner: :class:`str` banner: Optional[:class:`str`]
Banner hash Banner hash
premium_tier: :class:`str` premium_tier: Optional[:class:`str`]
Premium tier (Server Boost level) Premium tier (Server Boost level)
premium_subscription_count: :class:`int` premium_subscription_count: Optional[:class:`int`]
The number of boosts this guild currently has The number of boosts this guild currently has
preferred_locale: :class:`str` preferred_locale: Optional[:class:`str`]
The preferred locale of a Community guild; used in server discovery and notices from Discord, and sent in interactions; defaults to "en-US" The preferred locale of a Community guild;
public_updates_channel_id: :class:`~melisa.utils.types.Snowflake` used in server discovery and notices from Discord,
The id of the channel where admins and moderators of Community guilds receive notices from Discord and sent in interactions; defaults to "en-US"
max_video_channel_users: :class:`int` public_updates_channel_id: Optional[:class:`~melisa.utils.types.Snowflake`]
The id of the channel where admins and moderators of
Community guilds receive notices from Discord
max_video_channel_users: Optional[:class:`int`]
The maximum amount of users in a video channel The maximum amount of users in a video channel
approximate_member_count: :class:`int` approximate_member_count: Optional[:class:`int`]
Approximate number of members in this guild, returned from the `GET /guilds/<id>` endpoint when `with_counts` is `true` Approximate number of members in this guild,
approximate_presence_count: :class:`int` returned from the `GET /guilds/<id>` endpoint when `with_counts` is `true`
Approximate number of non-offline members in this guild, returned from the `GET /guilds/<id>` endpoint when `with_counts` is `true` approximate_presence_count: Optional[:class:`int`]
nsfw_level: :class:`int` Approximate number of non-offline members in this guild,
returned from the `GET /guilds/<id>`
endpoint when `with_counts` is `true`
nsfw_level: Optional[:class:`int`]
Guild NSFW level Guild NSFW level
premium_progress_bar_enabled: :class:`bool` premium_progress_bar_enabled: Optional[:class:`bool`]
Whether the guild has the boost progress bar enabled Whether the guild has the boost progress bar enabled
stage_instances: stage_instances: Optional[:class:`typing.Any`]
Stage instances in the guild Stage instances in the guild
stickers: stickers: Optional[:class:`typing.Any`]
Custom guild stickers Custom guild stickers
welcome_screen: welcome_screen: Optional[:class:`typing.Any`]
The welcome screen of a Community guild, shown to new members, returned in an Invite's guild object The welcome screen of a Community guild, shown to new members,
guild_scheduled_events: returned in an Invite's guild object
guild_scheduled_events: Optional[:class:`typing.Any`]
The scheduled events in the guild The scheduled events in the guild
""" """
@ -420,8 +432,10 @@ class Guild(APIModelBase):
@dataclass(repr=False) @dataclass(repr=False)
class UnavailableGuild(APIModelBase): class UnavailableGuild(APIModelBase):
"""A partial guild object. Represents an Offline Guild, or a Guild whose information has not been provided through Guild Create events during the Gateway connect. """A partial guild object.
Represents an Offline Guild, or a Guild whose information has not been provided
through Guild Create events during the Gateway connect.
Attributes Attributes
---------- ----------
id: :class:`~melisa.utils.types.Snowflake` id: :class:`~melisa.utils.types.Snowflake`

View file

@ -110,6 +110,7 @@ class VisibilityTypes(IntEnum):
@dataclass(repr=False) @dataclass(repr=False)
class User(APIModelBase): class User(APIModelBase):
# ToDo: Update Docstrings
"""User Structure """User Structure
Attributes Attributes