From bbd7a9f3da6bec57e87dec81ccb7cfa662ffaa11 Mon Sep 17 00:00:00 2001 From: dolfies Date: Wed, 1 Mar 2023 19:20:12 -0500 Subject: [PATCH] Fix Message.system_content --- discord/message.py | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/discord/message.py b/discord/message.py index 9373bc9bc..ca617233e 100644 --- a/discord/message.py +++ b/discord/message.py @@ -1685,7 +1685,7 @@ class Message(PartialMessage, Hashable): ) @utils.cached_slot_property('_cs_system_content') - def system_content(self) -> Optional[str]: + def system_content(self) -> str: r""":class:`str`: A property that returns the content that is rendered regardless of the :attr:`Message.type`. @@ -1693,15 +1693,6 @@ class Message(PartialMessage, Hashable): this just returns the regular :attr:`Message.content`. Otherwise this returns an English message denoting the contents of the system message. """ - - if self.type in { - MessageType.default, - MessageType.reply, - MessageType.chat_input_command, - MessageType.context_menu_command, - }: - return self.content - if self.type is MessageType.recipient_add: if self.channel.type is ChannelType.group: return f'{self.author.name} added {self.mentions[0].name} to the group.' @@ -1749,7 +1740,7 @@ class Message(PartialMessage, Hashable): if self.channel.me in self.call.participants: # type: ignore return f'{self.author.name} started a call.' elif call_ended: - return f'You missed a call from {self.author.name}' + return f'You missed a call from {self.author.name} that lasted {int((utils.utcnow() - self.call.ended_timestamp).total_seconds())} seconds.' # type: ignore else: return f'{self.author.name} started a call \N{EM DASH} Join the call.' @@ -1782,10 +1773,6 @@ class Message(PartialMessage, Hashable): f'{self.author.name} has added {self.content} to this channel. Its most important updates will show up here.' ) - if self.type is MessageType.guild_stream: - # The author will be a Member - return f'{self.author.name} is live! Now streaming {self.author.activity.name}' # type: ignore - if self.type is MessageType.guild_discovery_disqualified: return 'This server has been removed from Server Discovery because it no longer passes all the requirements. Check Server Settings for more details.' @@ -1799,7 +1786,7 @@ class Message(PartialMessage, Hashable): return 'This server has failed Discovery activity requirements for 3 weeks in a row. If this server fails for 1 more week, it will be removed from Discovery.' if self.type is MessageType.thread_created: - return f'{self.author.name} started a thread: **{self.content}**. See all **threads**.' + return f'{self.author.name} started a thread: **{self.content}**. See all threads.' if self.type is MessageType.thread_starter_message: if self.reference is None or self.reference.resolved is None: @@ -1811,6 +1798,8 @@ class Message(PartialMessage, Hashable): if self.type is MessageType.guild_invite_reminder: return 'Wondering who to invite?\nStart by inviting anyone who can help you build the server!' + return self.content + @overload async def edit( self,