Skip to content

Commit 098f4f5

Browse files
committed
feat(interactions): Added file parameter to BaseInteraction.edit
1 parent b49bbb8 commit 098f4f5

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

discord/interactions.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
Optional,
2323
Dict,
2424
Any,
25-
TYPE_CHECKING)
25+
TYPE_CHECKING
26+
)
27+
2628
from .components import Button, SelectMenu, ActionRow, Modal, TextInput
2729
from .channel import _channel_factory, TextChannel, VoiceChannel, DMChannel, ThreadChannel
2830
from .errors import NotFound, InvalidArgument, AlreadyResponded, UnknownInteraction
@@ -364,9 +366,6 @@ async def edit(self,
364366
365367
'Defers' if it isn't yet and edit the message.
366368
Depending on the :class:`~discord.InteractionType` of the interaction this edits the original message or the loading message.
367-
368-
369-
370369
"""
371370
if self.message_is_hidden or self.deferred_modal:
372371
return await self.message.edit(**fields)
@@ -431,7 +430,16 @@ async def edit(self,
431430
delete_after: Optional[float] = fields.pop('delete_after', None)
432431
files = None
433432
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')
435443
except KeyError:
436444
pass
437445
else:
@@ -551,7 +559,6 @@ async def respond(self,
551559
to the object, otherwise it uses the attributes set in :attr:`~discord.Client.allowed_mentions`.
552560
If no object is passed at all then the defaults given by :attr:`~discord.Client.allowed_mentions`
553561
are used instead.
554-
555562
hidden: Optional[:class:`bool`]
556563
If ``True`` the message will be only visible for the performer of the interaction (e.g. :attr:`~discord.BaseInteraction.author`).
557564
"""

0 commit comments

Comments
 (0)