From 8bbb8f6db969ba1525083e6d9d8a36d852d6fa81 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Mon, 23 Aug 2021 22:07:29 -0400 Subject: [PATCH] Use getattr for default_auto_archive_duration in Message.create_thread Some channel types do not have this attribute so a fallback is necessary to prevent the attribute access from erroring. --- discord/message.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/discord/message.py b/discord/message.py index 078aaa762..30eb49900 100644 --- a/discord/message.py +++ b/discord/message.py @@ -1527,11 +1527,12 @@ class Message(Hashable): if self.guild is None: raise InvalidArgument('This message does not have guild info attached.') + default_auto_archive_duration: ThreadArchiveDuration = getattr(self.channel, 'default_auto_archive_duration', 1440) data = await self._state.http.start_thread_with_message( self.channel.id, self.id, name=name, - auto_archive_duration=auto_archive_duration or self.channel.default_auto_archive_duration, + auto_archive_duration=auto_archive_duration or default_auto_archive_duration, ) return Thread(guild=self.guild, state=self._state, data=data)