Use Any instead of str for Embed typings for accuracy
This commit is contained in:
parent
d4df44375b
commit
9da2f349e7
@ -179,10 +179,10 @@ class Embed:
|
|||||||
*,
|
*,
|
||||||
colour: Union[int, Colour, _EmptyEmbed] = EmptyEmbed,
|
colour: Union[int, Colour, _EmptyEmbed] = EmptyEmbed,
|
||||||
color: Union[int, Colour, _EmptyEmbed] = EmptyEmbed,
|
color: Union[int, Colour, _EmptyEmbed] = EmptyEmbed,
|
||||||
title: MaybeEmpty[str] = EmptyEmbed,
|
title: MaybeEmpty[Any] = EmptyEmbed,
|
||||||
type: EmbedType = 'rich',
|
type: EmbedType = 'rich',
|
||||||
url: MaybeEmpty[str] = EmptyEmbed,
|
url: MaybeEmpty[Any] = EmptyEmbed,
|
||||||
description: MaybeEmpty[str] = EmptyEmbed,
|
description: MaybeEmpty[Any] = EmptyEmbed,
|
||||||
timestamp: datetime.datetime = None,
|
timestamp: datetime.datetime = None,
|
||||||
):
|
):
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ class Embed:
|
|||||||
"""
|
"""
|
||||||
return EmbedProxy(getattr(self, '_footer', {})) # type: ignore
|
return EmbedProxy(getattr(self, '_footer', {})) # type: ignore
|
||||||
|
|
||||||
def set_footer(self: E, *, text: MaybeEmpty[str] = EmptyEmbed, icon_url: MaybeEmpty[str] = EmptyEmbed) -> E:
|
def set_footer(self: E, *, text: MaybeEmpty[Any] = EmptyEmbed, icon_url: MaybeEmpty[Any] = EmptyEmbed) -> E:
|
||||||
"""Sets the footer for the embed content.
|
"""Sets the footer for the embed content.
|
||||||
|
|
||||||
This function returns the class instance to allow for fluent-style
|
This function returns the class instance to allow for fluent-style
|
||||||
@ -380,7 +380,7 @@ class Embed:
|
|||||||
"""
|
"""
|
||||||
return EmbedProxy(getattr(self, '_image', {})) # type: ignore
|
return EmbedProxy(getattr(self, '_image', {})) # type: ignore
|
||||||
|
|
||||||
def set_image(self: E, *, url: MaybeEmpty[str]) -> E:
|
def set_image(self: E, *, url: MaybeEmpty[Any]) -> E:
|
||||||
"""Sets the image for the embed content.
|
"""Sets the image for the embed content.
|
||||||
|
|
||||||
This function returns the class instance to allow for fluent-style
|
This function returns the class instance to allow for fluent-style
|
||||||
@ -422,7 +422,7 @@ class Embed:
|
|||||||
"""
|
"""
|
||||||
return EmbedProxy(getattr(self, '_thumbnail', {})) # type: ignore
|
return EmbedProxy(getattr(self, '_thumbnail', {})) # type: ignore
|
||||||
|
|
||||||
def set_thumbnail(self: E, *, url: MaybeEmpty[str]) -> E:
|
def set_thumbnail(self: E, *, url: MaybeEmpty[Any]) -> E:
|
||||||
"""Sets the thumbnail for the embed content.
|
"""Sets the thumbnail for the embed content.
|
||||||
|
|
||||||
This function returns the class instance to allow for fluent-style
|
This function returns the class instance to allow for fluent-style
|
||||||
@ -483,7 +483,7 @@ class Embed:
|
|||||||
"""
|
"""
|
||||||
return EmbedProxy(getattr(self, '_author', {})) # type: ignore
|
return EmbedProxy(getattr(self, '_author', {})) # type: ignore
|
||||||
|
|
||||||
def set_author(self: E, *, name: str, url: MaybeEmpty[str] = EmptyEmbed, icon_url: MaybeEmpty[str] = EmptyEmbed) -> E:
|
def set_author(self: E, *, name: Any, url: MaybeEmpty[Any] = EmptyEmbed, icon_url: MaybeEmpty[Any] = EmptyEmbed) -> E:
|
||||||
"""Sets the author for the embed content.
|
"""Sets the author for the embed content.
|
||||||
|
|
||||||
This function returns the class instance to allow for fluent-style
|
This function returns the class instance to allow for fluent-style
|
||||||
@ -536,7 +536,7 @@ class Embed:
|
|||||||
"""
|
"""
|
||||||
return [EmbedProxy(d) for d in getattr(self, '_fields', [])] # type: ignore
|
return [EmbedProxy(d) for d in getattr(self, '_fields', [])] # type: ignore
|
||||||
|
|
||||||
def add_field(self: E, *, name: str, value: str, inline: bool = True) -> E:
|
def add_field(self: E, *, name: Any, value: Any, inline: bool = True) -> E:
|
||||||
"""Adds a field to the embed object.
|
"""Adds a field to the embed object.
|
||||||
|
|
||||||
This function returns the class instance to allow for fluent-style
|
This function returns the class instance to allow for fluent-style
|
||||||
@ -565,7 +565,7 @@ class Embed:
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def insert_field_at(self: E, index: int, *, name: str, value: str, inline: bool = True) -> E:
|
def insert_field_at(self: E, index: int, *, name: Any, value: Any, inline: bool = True) -> E:
|
||||||
"""Inserts a field before a specified index to the embed.
|
"""Inserts a field before a specified index to the embed.
|
||||||
|
|
||||||
This function returns the class instance to allow for fluent-style
|
This function returns the class instance to allow for fluent-style
|
||||||
@ -626,7 +626,7 @@ class Embed:
|
|||||||
except (AttributeError, IndexError):
|
except (AttributeError, IndexError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def set_field_at(self: E, index: int, *, name: str, value: str, inline: bool = True) -> E:
|
def set_field_at(self: E, index: int, *, name: Any, value: Any, inline: bool = True) -> E:
|
||||||
"""Modifies a field to the embed object.
|
"""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.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user