From 13359372887abced96566bbf26a96e065faee782 Mon Sep 17 00:00:00 2001 From: Rapptz <rapptz@gmail.com> Date: Thu, 23 Jun 2022 04:17:56 -0400 Subject: [PATCH] Add Thread.starter_message property --- discord/threads.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/discord/threads.py b/discord/threads.py index fe068813b..a70ec680a 100644 --- a/discord/threads.py +++ b/discord/threads.py @@ -91,7 +91,7 @@ class Thread(Messageable, Hashable): guild: :class:`Guild` The guild the thread belongs to. id: :class:`int` - The thread ID. + The thread ID. This is the same as the thread starter message ID. parent_id: :class:`int` The parent :class:`TextChannel` or :class:`ForumChannel` ID this thread belongs to. owner_id: :class:`int` @@ -255,9 +255,24 @@ class Thread(Messageable, Hashable): """ return list(self._members.values()) + @property + def starter_message(self) -> Optional[Message]: + """Returns the thread starter message from the cache. + + The message might not be cached, valid, or point to an existing message. + + Note that the thread starter message ID is the same ID as the thread. + + Returns + -------- + Optional[:class:`Message`] + The thread starter message or ``None`` if not found. + """ + return self._state._get_message(self.id) + @property def last_message(self) -> Optional[Message]: - """Fetches the last message from this channel in cache. + """Returns the last message from this thread from the cache. The message might not be valid or point to an existing message.