Skip to content

Commit 08370b5

Browse files
authored
fix: AttributeError using PartialMessage.edit(embed=None) (#2446)
* Update message.py * changelog --------- Co-authored-by: Readeem <[email protected]>
1 parent 2cc5502 commit 08370b5

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ These changes are available on the `master` branch, but have not yet been releas
4444
([#2411](https://github.com/Pycord-Development/pycord/pull/2411))
4545
- Fixed option typehints being ignored when using `parameter_name`.
4646
([#2417](https://github.com/Pycord-Development/pycord/pull/2417))
47+
- Fixed parameter `embed=None` causing `AttributeError` on `PartialMessage.edit`.
48+
([#2446](https://github.com/Pycord-Development/pycord/pull/2446))
4749

4850
### Changed
4951

discord/message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2039,7 +2039,7 @@ async def edit(self, **fields: Any) -> Message | None:
20392039
raise InvalidArgument("Cannot pass both embed and embeds parameters.")
20402040

20412041
if embed is not MISSING:
2042-
fields["embeds"] = [embed.to_dict()]
2042+
fields["embeds"] = [] if embed is None else [embed.to_dict()]
20432043

20442044
if embeds is not MISSING:
20452045
fields["embeds"] = [embed.to_dict() for embed in embeds]

0 commit comments

Comments
 (0)