|
22 | 22 | Optional,
|
23 | 23 | Dict,
|
24 | 24 | Any,
|
25 |
| - TYPE_CHECKING) |
| 25 | + TYPE_CHECKING |
| 26 | +) |
| 27 | + |
26 | 28 | from .components import Button, SelectMenu, ActionRow, Modal, TextInput
|
27 | 29 | from .channel import _channel_factory, TextChannel, VoiceChannel, DMChannel, ThreadChannel
|
28 | 30 | from .errors import NotFound, InvalidArgument, AlreadyResponded, UnknownInteraction
|
@@ -364,9 +366,6 @@ async def edit(self,
|
364 | 366 |
|
365 | 367 | 'Defers' if it isn't yet and edit the message.
|
366 | 368 | Depending on the :class:`~discord.InteractionType` of the interaction this edits the original message or the loading message.
|
367 |
| -
|
368 |
| -
|
369 |
| -
|
370 | 369 | """
|
371 | 370 | if self.message_is_hidden or self.deferred_modal:
|
372 | 371 | return await self.message.edit(**fields)
|
@@ -431,7 +430,16 @@ async def edit(self,
|
431 | 430 | delete_after: Optional[float] = fields.pop('delete_after', None)
|
432 | 431 | files = None
|
433 | 432 | try:
|
434 |
| - files: Optional[List[File]] = fields['files'] |
| 433 | + file: Optional[File] = fields.pop('file') |
| 434 | + except KeyError: |
| 435 | + pass |
| 436 | + else: |
| 437 | + try: |
| 438 | + fields['files'].append(file) |
| 439 | + except KeyError: |
| 440 | + fields['files'] = [file] |
| 441 | + try: |
| 442 | + files: Optional[List[File]] = fields.pop('files') |
435 | 443 | except KeyError:
|
436 | 444 | pass
|
437 | 445 | else:
|
@@ -551,7 +559,6 @@ async def respond(self,
|
551 | 559 | to the object, otherwise it uses the attributes set in :attr:`~discord.Client.allowed_mentions`.
|
552 | 560 | If no object is passed at all then the defaults given by :attr:`~discord.Client.allowed_mentions`
|
553 | 561 | are used instead.
|
554 |
| -
|
555 | 562 | hidden: Optional[:class:`bool`]
|
556 | 563 | If ``True`` the message will be only visible for the performer of the interaction (e.g. :attr:`~discord.BaseInteraction.author`).
|
557 | 564 | """
|
|
0 commit comments