Skip to content
This repository was archived by the owner on Dec 18, 2021. It is now read-only.

Commit 809a836

Browse files
committed
refactor: improve type hints
1 parent 5b3d951 commit 809a836

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

discord_components/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async def send_component_msg(
8484
mention_author: bool = None,
8585
allowed_mentions: AllowedMentions = None,
8686
reference: Message = None,
87-
components: Union[List[Component], List[List[Component]]] = None,
87+
components: List[Union[Component, List[Component]]] = None,
8888
delete_after: float = None,
8989
**options,
9090
) -> Message:
@@ -175,7 +175,7 @@ async def edit_component_msg(
175175
*,
176176
embed: Embed = None,
177177
allowed_mentions: AllowedMentions = None,
178-
components: Union[List[Component], List[List[Component]]] = None,
178+
components: List[Union[Component, List[Component]]] = None,
179179
**options,
180180
):
181181
state = self.bot._get_state()

discord_components/interaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ async def respond(
7575
allowed_mentions: AllowedMentions = None,
7676
tts: bool = False,
7777
ephemeral: bool = True,
78-
components: Union[List[Component], List[List[Component]]] = None,
78+
components: List[Union[Component, List[Component]]] = None,
7979
**options,
8080
) -> None:
8181
if self.responded:

discord_components/message.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55

66

77
class ComponentMessage(Message):
8-
def __init__(
9-
self, *, components: Union[List[Component], List[List[Component]]] = None, **kwargs
10-
):
8+
def __init__(self, *, components: List[Union[Component, List[Component]]] = [], **kwargs):
119
super().__init__(**kwargs)
12-
if components is None:
13-
components = []
1410
self.components = components

0 commit comments

Comments
 (0)