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

Commit 5151045

Browse files
♻️ Using collection to improve convert_message
1 parent 09f6250 commit 5151045

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pincer/utils/convert_message.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from __future__ import annotations
55

6+
from collections import defaultdict
67
from collections.abc import Iterable
78
from typing import TYPE_CHECKING, Tuple, List
89
from typing import Union
@@ -42,8 +43,8 @@ def convert_message(client: Client, message: MessageConvertable) -> Message:
4243
:class:`~pincer.objects.message.message.Message`
4344
The message object to be sent
4445
"""
45-
if message and isinstance(message, (tuple, list)):
46-
kwargs = {"attachments": [], "embeds": [], "components": []}
46+
if message and isinstance(message, Iterable):
47+
kwargs = defaultdict(list)
4748
for item in message:
4849
list_to_message_dict(item, kwargs)
4950
message = Message(**kwargs)

0 commit comments

Comments
 (0)