Browse Source
Upgrade code by using f-strings and yield from
pull/10306/head
Lucas Hardt
10 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
6 additions and
8 deletions
-
discord/message.py
-
discord/ui/action_row.py
-
discord/ui/section.py
|
|
|
@ -2843,14 +2843,14 @@ class Message(PartialMessage, Hashable): |
|
|
|
if call_ended: |
|
|
|
duration = utils._format_call_duration(self.call.duration) # type: ignore # call can't be None here |
|
|
|
if missed: |
|
|
|
return 'You missed a call from {0.author.name} that lasted {1}.'.format(self, duration) |
|
|
|
return f'You missed a call from {self.author.name} that lasted {duration}.' |
|
|
|
else: |
|
|
|
return '{0.author.name} started a call that lasted {1}.'.format(self, duration) |
|
|
|
return f'{self.author.name} started a call that lasted {duration}.' |
|
|
|
else: |
|
|
|
if missed: |
|
|
|
return '{0.author.name} started a call. \N{EM DASH} Join the call'.format(self) |
|
|
|
return f'{self.author.name} started a call. \N{EM DASH} Join the call' |
|
|
|
else: |
|
|
|
return '{0.author.name} started a call.'.format(self) |
|
|
|
return f'{self.author.name} started a call.' |
|
|
|
|
|
|
|
if self.type is MessageType.purchase_notification and self.purchase_notification is not None: |
|
|
|
guild_product_purchase = self.purchase_notification.guild_product_purchase |
|
|
|
|
|
|
|
@ -227,8 +227,7 @@ class ActionRow(Item[V]): |
|
|
|
An item in the action row. |
|
|
|
""" |
|
|
|
|
|
|
|
for child in self.children: |
|
|
|
yield child |
|
|
|
yield from self.children |
|
|
|
|
|
|
|
def content_length(self) -> int: |
|
|
|
""":class:`int`: Returns the total length of all text content in this action row.""" |
|
|
|
|
|
|
|
@ -137,8 +137,7 @@ class Section(Item[V]): |
|
|
|
An item in this section. |
|
|
|
""" |
|
|
|
|
|
|
|
for child in self.children: |
|
|
|
yield child |
|
|
|
yield from self.children |
|
|
|
yield self.accessory |
|
|
|
|
|
|
|
def _update_view(self, view) -> None: |
|
|
|
|