|
40 | 40 | from .partial_emoji import PartialEmoji
|
41 | 41 | from .calls import CallMessage
|
42 | 42 | from .enums import MessageType, ChannelType, try_enum
|
43 |
| -from .errors import InvalidArgument, ClientException, HTTPException, NotFound |
| 43 | +from .errors import InvalidArgument, ClientException, HTTPException, NotFound, UnknowInteraction |
44 | 44 | from .embeds import Embed
|
45 | 45 | from .components import DecodeMessageComponents, Button, DropdownMenue, ActionRow
|
46 | 46 | from .member import Member
|
@@ -842,7 +842,7 @@ def clean_content(self):
|
842 | 842 | .. note::
|
843 | 843 |
|
844 | 844 | This *does not* affect markdown. If you want to escape
|
845 |
| - or remove markdown then use :func:`utils.escape_markdown` or :func:`utils.remove_markdown` |
| 845 | + or remove markdown then use :func:`utils.escape_markdown` or :func:`utils.remove_markdown` |
846 | 846 | respectively, along with this function.
|
847 | 847 | """
|
848 | 848 |
|
@@ -1154,17 +1154,19 @@ async def edit(self, **fields):
|
1154 | 1154 | interaction_token = fields.pop('__interaction_token', None)
|
1155 | 1155 | application_id = fields.pop('__application_id', None)
|
1156 | 1156 | payload = {'data': fields}
|
1157 |
| - if not deffered is True: |
| 1157 | + if not deffered: |
1158 | 1158 | payload['type'] = 7
|
1159 | 1159 | if payload:
|
1160 | 1160 | try:
|
1161 | 1161 | data = await self._state.http.edit_interaction_response(use_webhook=use_webhook,
|
1162 | 1162 | interaction_id=interaction_id,
|
1163 | 1163 | token=interaction_token,
|
1164 | 1164 | application_id=application_id,
|
| 1165 | + deffered=deffered, |
1165 | 1166 | fields=payload)
|
1166 |
| - except NotFound: |
1167 |
| - raise NotFound("You have already responded to this Interaction!") |
| 1167 | + except Exception as exc: |
| 1168 | + print (exc) |
| 1169 | + raise UnknowInteraction(application_id) |
1168 | 1170 | else:
|
1169 | 1171 | self._update(dict(data))
|
1170 | 1172 |
|
@@ -1685,19 +1687,16 @@ async def edit(self, **fields):
|
1685 | 1687 | interaction_token = fields.pop('__interaction_token', None)
|
1686 | 1688 | application_id = fields.pop('__application_id', None)
|
1687 | 1689 | payload = {'data': fields}
|
1688 |
| - if not deffered is True: |
1689 |
| - payload['type'] = 7 |
1690 | 1690 | if payload:
|
1691 | 1691 | try:
|
1692 |
| - r = await self._state.http.edit_interaction_response(use_webhook=use_webhook, |
1693 |
| - interaction_id=interaction_id, |
1694 |
| - token=interaction_token, |
1695 |
| - application_id=application_id, |
1696 |
| - fields=payload) |
| 1692 | + data = await self._state.http.edit_interaction_response(use_webhook=use_webhook, |
| 1693 | + interaction_id=interaction_id, |
| 1694 | + token=interaction_token, |
| 1695 | + application_id=application_id, |
| 1696 | + deffered=deffered, |
| 1697 | + fields=payload) |
1697 | 1698 | except NotFound:
|
1698 |
| - raise NotFound(r, "You have already responded to this Interaction!") |
1699 |
| - else: |
1700 |
| - self._update(payload['data']) |
| 1699 | + raise UnknowInteraction(application_id) |
1701 | 1700 |
|
1702 | 1701 | elif is_interaction_responce is None:
|
1703 | 1702 | payload = await self._state.http.edit_message(self.channel.id, self.id, **fields)
|
|
0 commit comments