Skip to content

Commit 7555fc2

Browse files
authored
fix: (Sync)WebhookMessage._thread_id could be None (Pycord-Development#2343)
* fix: check if thread_id is None * chore: add changelog entry
1 parent 98d6018 commit 7555fc2

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ These changes are available on the `master` branch, but have not yet been releas
230230
([#2333](https://github.com/Pycord-Development/pycord/issues/2333))
231231
- Fixed `BridgeContext` type hints raising an exception for unsupported option type.
232232
([#2337](https://github.com/Pycord-Development/pycord/pull/2337))
233+
- Fixed `TypeError` due to `(Sync)WebhookMessage._thread_id` being set to `None`.
234+
([#2343](https://github.com/Pycord-Development/pycord/pull/2343))
233235

234236
## [2.4.1] - 2023-03-20
235237

discord/webhook/async_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ async def fetch_message(
18551855
thread_id=thread_id,
18561856
)
18571857
msg = self._create_message(data)
1858-
if isinstance(msg.channel, PartialMessageable):
1858+
if thread_id and isinstance(msg.channel, PartialMessageable):
18591859
msg._thread_id = thread_id
18601860

18611861
return msg

discord/webhook/sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ def fetch_message(
11471147
thread_id=thread_id,
11481148
)
11491149
msg = self._create_message(data)
1150-
if isinstance(msg.channel, PartialMessageable):
1150+
if thread_id and isinstance(msg.channel, PartialMessageable):
11511151
msg._thread_id = thread_id
11521152

11531153
return msg

0 commit comments

Comments
 (0)