Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Modal and Embed Parameter Limits #1247

Merged
merged 3 commits into from
Apr 17, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 13 additions & 3 deletions discord/embeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class Embed:
title: :class:`str`
The title of the embed.
This can be set during initialisation.
Must be 256 characters or fewer.
type: :class:`str`
The type of embed. Usually "rich".
This can be set during initialisation.
Expand All @@ -152,6 +153,7 @@ class Embed:
description: :class:`str`
The description of the embed.
This can be set during initialisation.
Must be 4096 characters or fewer.
url: :class:`str`
The URL of the embed.
This can be set during initialisation.
Expand Down Expand Up @@ -380,6 +382,7 @@ def set_footer(
-----------
text: :class:`str`
The footer text.
Must be 2048 characters or fewer.
icon_url: :class:`str`
The URL of the footer icon. Only HTTP(S) is supported.
"""
Expand Down Expand Up @@ -572,6 +575,7 @@ def set_author(
-----------
name: :class:`str`
The name of the author.
Must be 256 characters or fewer.
url: :class:`str`
The URL for the author.
icon_url: :class:`str`
Expand Down Expand Up @@ -619,14 +623,16 @@ def add_field(self: E, *, name: Any, value: Any, inline: bool = True) -> E:
"""Adds a field to the embed object.

This function returns the class instance to allow for fluent-style
chaining.
chaining. There must be 25 fields or fewer.

Parameters
-----------
name: :class:`str`
The name of the field.
Must be 256 characters or fewer.
value: :class:`str`
The value of the field.
Must be 1024 characters or fewer.
inline: :class:`bool`
Whether the field should be displayed inline.
"""
Expand All @@ -648,7 +654,7 @@ def insert_field_at(self: E, index: int, *, name: Any, value: Any, inline: bool
"""Inserts a field before a specified index to the embed.

This function returns the class instance to allow for fluent-style
chaining.
chaining. There must be 25 fields or fewer.

.. versionadded:: 1.2

Expand All @@ -658,8 +664,10 @@ def insert_field_at(self: E, index: int, *, name: Any, value: Any, inline: bool
The index of where to insert the field.
name: :class:`str`
The name of the field.
Must be 256 characters or fewer.
value: :class:`str`
The value of the field.
Must be 1024 characters or fewer.
inline: :class:`bool`
Whether the field should be displayed inline.
"""
Expand Down Expand Up @@ -708,7 +716,7 @@ def remove_field(self, index: int) -> None:
def set_field_at(self: E, index: int, *, name: Any, value: Any, inline: bool = True) -> E:
"""Modifies a field to the embed object.

The index must point to a valid pre-existing field.
The index must point to a valid pre-existing field. There must be 25 fields or fewer.

This function returns the class instance to allow for fluent-style
chaining.
Expand All @@ -719,8 +727,10 @@ def set_field_at(self: E, index: int, *, name: Any, value: Any, inline: bool = T
The index of the field to modify.
name: :class:`str`
The name of the field.
Must be 256 characters or fewer.
value: :class:`str`
The value of the field.
Must be 1024 characters or fewer.
inline: :class:`bool`
Whether the field should be displayed inline.

Expand Down
1 change: 1 addition & 0 deletions discord/ui/modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Modal:
Must be 45 characters or fewer.
custom_id: Optional[:class:`str`]
The ID of the modal dialog that gets received during an interaction.
Must be 100 characters or fewer.
"""

def __init__(self, title: str, custom_id: Optional[str] = None) -> None:
Expand Down