diff --git a/discord/embeds.py b/discord/embeds.py index 630f3d8c2..53103dd65 100644 --- a/discord/embeds.py +++ b/discord/embeds.py @@ -602,24 +602,39 @@ class Embed: return self - def clear_fields(self) -> None: - """Removes all fields from this embed.""" + def clear_fields(self) -> Self: + """Removes all fields from this embed. + + This function returns the class instance to allow for fluent-style + chaining. + + .. versionchanged:: 2.0 + This function now returns the class instance. + """ try: self._fields.clear() except AttributeError: self._fields = [] - def remove_field(self, index: int) -> None: + return self + + def remove_field(self, index: int) -> Self: """Removes a field at a specified index. If the index is invalid or out of bounds then the error is silently swallowed. + This function returns the class instance to allow for fluent-style + chaining. + .. note:: When deleting a field by index, the index of the other fields shift to fill the gap just like a regular list. + .. versionchanged:: 2.0 + This function now returns the class instance. + Parameters ----------- index: :class:`int` @@ -630,6 +645,8 @@ class Embed: except (AttributeError, IndexError): pass + return self + def set_field_at(self, index: int, *, name: Any, value: Any, inline: bool = True) -> Self: """Modifies a field to the embed object.