mirror of
https://github.com/MelisaDev/melisa.git
synced 2024-11-11 19:07:28 +03:00
pep-8, update docs, update docstrings, do some flake8 checks and fixes
This commit is contained in:
parent
abce5e9116
commit
d3cda4069f
3 changed files with 92 additions and 76 deletions
|
@ -4,4 +4,5 @@ Melisa Models
|
|||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
user
|
||||
user
|
||||
guild
|
||||
|
|
|
@ -14,7 +14,7 @@ from ...utils.types import APINullable
|
|||
|
||||
class DefaultMessageNotificationLevel(IntEnum):
|
||||
"""Message notification level
|
||||
|
||||
|
||||
Attributes
|
||||
----------
|
||||
ALL_MESSAGES:
|
||||
|
@ -53,7 +53,7 @@ class ExplicitContentFilterLevel(IntEnum):
|
|||
|
||||
class MFALevel(IntEnum):
|
||||
"""MFA Level
|
||||
|
||||
|
||||
Attributes
|
||||
----------
|
||||
NONE:
|
||||
|
@ -174,49 +174,50 @@ class GuildFeatures(Enum):
|
|||
Attributes
|
||||
----------
|
||||
ANIMATED_ICON:
|
||||
Guild has access to set an animated guild icon
|
||||
Guild has access to set an animated guild icon
|
||||
BANNER:
|
||||
Guild has access to set a guild banner image
|
||||
Guild has access to set a guild banner image
|
||||
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:
|
||||
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:
|
||||
Guild is able to be discovered in the directory
|
||||
Guild is able to be discovered in the directory
|
||||
FEATURABLE:
|
||||
Guild is able to be featured in the directory
|
||||
Guild is able to be featured in the directory
|
||||
INVITE_SPLASH:
|
||||
Guild has access to set an invite splash background
|
||||
Guild has access to set an invite splash background
|
||||
MEMBER_VERIFICATION_GATE_ENABLED:
|
||||
Guild has enabled Membership Screening
|
||||
Guild has enabled Membership Screening
|
||||
MONETIZATION_ENABLED:
|
||||
Guild has enabled monetization
|
||||
Guild has enabled monetization
|
||||
MORE_STICKERS:
|
||||
Guild has increased custom sticker slots
|
||||
Guild has increased custom sticker slots
|
||||
NEWS:
|
||||
Guild has access to create news channels
|
||||
Guild has access to create news channels
|
||||
PARTNERED:
|
||||
Guild is partnered
|
||||
Guild is partnered
|
||||
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:
|
||||
Guild has access to create private threads
|
||||
Guild has access to create private threads
|
||||
ROLE_ICONS:
|
||||
Guild is able to set role icons
|
||||
Guild is able to set role icons
|
||||
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:
|
||||
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:
|
||||
Guild has enabled ticketed events
|
||||
Guild has enabled ticketed events
|
||||
VANITY_URL:
|
||||
Guild has access to set a vanity URL
|
||||
Guild has access to set a vanity URL
|
||||
VERIFIED:
|
||||
Guild is verified
|
||||
Guild is verified
|
||||
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:
|
||||
Guild has enabled the welcome screen
|
||||
Guild has enabled the welcome screen
|
||||
"""
|
||||
|
||||
ANIMATED_ICON = "ANIMATED_ICON"
|
||||
|
@ -245,8 +246,9 @@ class GuildFeatures(Enum):
|
|||
|
||||
@dataclass(repr=False)
|
||||
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
|
||||
----------
|
||||
id: :class:`~melisa.utils.types.Snowflake`
|
||||
|
@ -255,21 +257,21 @@ class Guild(APIModelBase):
|
|||
Guild name (2-100 characters, excluding trailing and leading whitespace)
|
||||
icon: :class:`str`
|
||||
Icon hash
|
||||
icon_hash: :class:`str`
|
||||
icon_hash: Optional[:class:`str`]
|
||||
Icon hash, returned when in the template object
|
||||
splash: :class:`str`
|
||||
splash: Optional[:class:`str`]
|
||||
Splash hash
|
||||
discovery_splash: :class:`str`
|
||||
discovery_splash: Optional[:class:`str`]
|
||||
Discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
|
||||
owner: :class:`bool`
|
||||
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
|
||||
permissions: :class:`str`
|
||||
permissions: Optional[:class:`str`]
|
||||
Total permissions for the user in the guild (excludes overwrites)
|
||||
region: :class:`str`
|
||||
region: Optional[:class:`str`]
|
||||
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
|
||||
afk_timeout: :class:`int`
|
||||
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
|
||||
verification_level: :class:`int`
|
||||
Verification level required for the guild
|
||||
default_message_notifications: :class:`int`
|
||||
default_message_notifications: Optional[:class:`int`]
|
||||
Default message notifications level
|
||||
explicit_content_filter: :class:`int`
|
||||
Explicit content filter level
|
||||
features:
|
||||
features: Optional[:class:`typing.Any`]
|
||||
Enabled guild features
|
||||
roles:
|
||||
roles: Optional[:class:`typing.Any`]
|
||||
Roles in the guild
|
||||
emojis:
|
||||
emojis: Optional[:class:`typing.Any`]
|
||||
Custom guild emojis
|
||||
mfa_level: :class:`int`
|
||||
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
|
||||
system_channel_id: :class:`~melisa.utils.types.Snowflake`
|
||||
The id of the channel where guild notices such as welcome messages and boost events are posted
|
||||
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
|
||||
system_channel_flags: :class:`int`
|
||||
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
|
||||
joined_at: :class:`int`
|
||||
joined_at: Optional[:class:`int`]
|
||||
When this guild was joined at
|
||||
large: :class:`bool`
|
||||
large: Optional[:class:`bool`]
|
||||
True if this is considered a large guild
|
||||
unavailable: :class:`bool`
|
||||
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
|
||||
voice_states:
|
||||
States of members currently in voice channels; lacks the `guild_id` key
|
||||
members:
|
||||
members: Optional[:class:`typing.Any`]
|
||||
Users in the guild
|
||||
channels:
|
||||
channels: Optional[:class:`typing.Any`]
|
||||
Channels in the guild
|
||||
threads:
|
||||
threads: Optional[:class:`typing.Any`]
|
||||
All active threads in the guild that current user has permission to view
|
||||
presences:
|
||||
Presences of the members in the guild, will only include non-offline members if the size is greater than `large threshold`
|
||||
max_presences: :class:`int`
|
||||
The maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds)
|
||||
max_members: :class:`int`
|
||||
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`
|
||||
max_presences: Optional[: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
|
||||
vanity_url_code: :class:`str`
|
||||
vanity_url_code: Optional[:class:`str`]
|
||||
The vanity url code for the guild
|
||||
description: :class:`str`
|
||||
description: Optional[:class:`str`]
|
||||
The description of a Community guild
|
||||
banner: :class:`str`
|
||||
banner: Optional[:class:`str`]
|
||||
Banner hash
|
||||
premium_tier: :class:`str`
|
||||
premium_tier: Optional[:class:`str`]
|
||||
Premium tier (Server Boost level)
|
||||
premium_subscription_count: :class:`int`
|
||||
premium_subscription_count: Optional[:class:`int`]
|
||||
The number of boosts this guild currently has
|
||||
preferred_locale: :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"
|
||||
public_updates_channel_id: :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: :class:`int`
|
||||
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"
|
||||
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
|
||||
approximate_member_count: :class:`int`
|
||||
Approximate number of members in this guild, returned from the `GET /guilds/<id>` endpoint when `with_counts` is `true`
|
||||
approximate_presence_count: :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: :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_presence_count: Optional[: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
|
||||
premium_progress_bar_enabled: :class:`bool`
|
||||
premium_progress_bar_enabled: Optional[:class:`bool`]
|
||||
Whether the guild has the boost progress bar enabled
|
||||
stage_instances:
|
||||
stage_instances: Optional[:class:`typing.Any`]
|
||||
Stage instances in the guild
|
||||
stickers:
|
||||
stickers: Optional[:class:`typing.Any`]
|
||||
Custom guild stickers
|
||||
welcome_screen:
|
||||
The welcome screen of a Community guild, shown to new members, returned in an Invite's guild object
|
||||
guild_scheduled_events:
|
||||
welcome_screen: Optional[:class:`typing.Any`]
|
||||
The welcome screen of a Community guild, shown to new members,
|
||||
returned in an Invite's guild object
|
||||
guild_scheduled_events: Optional[:class:`typing.Any`]
|
||||
The scheduled events in the guild
|
||||
"""
|
||||
|
||||
|
@ -420,8 +432,10 @@ class Guild(APIModelBase):
|
|||
|
||||
@dataclass(repr=False)
|
||||
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
|
||||
----------
|
||||
id: :class:`~melisa.utils.types.Snowflake`
|
||||
|
|
|
@ -110,6 +110,7 @@ class VisibilityTypes(IntEnum):
|
|||
|
||||
@dataclass(repr=False)
|
||||
class User(APIModelBase):
|
||||
# ToDo: Update Docstrings
|
||||
"""User Structure
|
||||
|
||||
Attributes
|
||||
|
|
Loading…
Reference in a new issue