Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ These changes are available on the `master` branch, but have not yet been releas

### Fixed

- Fix `TypeError` when accessing `ApplicationCommand.guild_only` or
- Fixed `TypeError` when accessing `ApplicationCommand.guild_only` or
`SlashCommandGroup.guild_only` when `contexts` is `None`.
([#3320](https://github.com/Pycord-Development/pycord/pull/3320))
- Fix `SyntaxWarning` about `return` in a `finally` block raised on Python 3.14+
- Fixed `SyntaxWarning` about `return` in a `finally` block raised on Python 3.14+
([#3332](https://github.com/Pycord-Development/pycord/pull/3334))
- Fixed `AttributeError` when fetching a message from a `PartialMessageable` that has a
Comment thread
Paillat-dev marked this conversation as resolved.
Outdated
thread. ([#3309](https://github.com/Pycord-Development/pycord/pull/3309))

### Deprecated

Expand Down
15 changes: 9 additions & 6 deletions discord/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1201,13 +1201,16 @@ def __init__(
except KeyError:
self._poll = None

self.thread: Thread | None
try:
self.thread = Thread(
guild=self.guild, state=self._state, data=data["thread"]
self.thread: Thread | None = None
if thread_data := data.get("thread"):
# When fetching from a PartialMessageable we don't have a guild so we need to fallback here
Comment thread
Paillat-dev marked this conversation as resolved.
Outdated
guild = self.guild or state._get_guild(
utils._get_as_snowflake(thread_data, "guild_id")
)
except KeyError:
self.thread = None
if guild is not None:
self.thread = guild.get_thread(int(thread_data["id"])) or Thread(
guild=guild, state=self._state, data=thread_data
)

self.call: MessageCall | None
try:
Expand Down
6 changes: 5 additions & 1 deletion discord/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ def _from_data(self, data: ThreadPayload):
]

# Here, we try to fill in potentially missing data
if thread := self.guild.get_thread(self.id) and data.pop("_invoke_flag", False):
if (
self.guild
and (thread := self.guild.get_thread(self.id))
and data.pop("_invoke_flag", False)
):
self.owner_id = thread.owner_id if self.owner_id is None else self.owner_id
self.last_message_id = (
thread.last_message_id
Expand Down