Skip to content

Commit

Permalink
fix: (Sync)WebhookMessage._thread_id could be None (Pycord-Develo…
Browse files Browse the repository at this point in the history
…pment#2343)

* fix: check if thread_id is None

* chore: add changelog entry
  • Loading branch information
Dorukyum authored Feb 1, 2024
1 parent 98d6018 commit 7555fc2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ These changes are available on the `master` branch, but have not yet been releas
([#2333](https://github.com/Pycord-Development/pycord/issues/2333))
- Fixed `BridgeContext` type hints raising an exception for unsupported option type.
([#2337](https://github.com/Pycord-Development/pycord/pull/2337))
- Fixed `TypeError` due to `(Sync)WebhookMessage._thread_id` being set to `None`.
([#2343](https://github.com/Pycord-Development/pycord/pull/2343))

## [2.4.1] - 2023-03-20

Expand Down
2 changes: 1 addition & 1 deletion discord/webhook/async_.py
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,7 @@ async def fetch_message(
thread_id=thread_id,
)
msg = self._create_message(data)
if isinstance(msg.channel, PartialMessageable):
if thread_id and isinstance(msg.channel, PartialMessageable):
msg._thread_id = thread_id

return msg
Expand Down
2 changes: 1 addition & 1 deletion discord/webhook/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ def fetch_message(
thread_id=thread_id,
)
msg = self._create_message(data)
if isinstance(msg.channel, PartialMessageable):
if thread_id and isinstance(msg.channel, PartialMessageable):
msg._thread_id = thread_id

return msg
Expand Down

0 comments on commit 7555fc2

Please sign in to comment.