Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Commit 88410ec

Browse files
author
kuso-senpai
committed
changed docs
1 parent 2caddcc commit 88410ec

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ You can find more (and better) examples [here](https://github.com/discord-py-ui/
205205
> Listening component callback functions now only take one parameter, the used component
206206
- `on_button_press` and `on_menu_select`
207207
> These events now take a sole parameter, the used component. If you want to acces to message, use `passed_component.message`
208+
209+
## **Removed**
210+
- ResponseMessage
211+
> Removed ResponseMessage
208212
</details>
209213
210214
- <details>

discord_ui/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from .slash.tools import ParseMethod
3838
from .tools import components_to_dict
3939
from .slash.tools import create_choice
40-
from .receive import Interaction, InteractionType, ResponseMessage, Message, WebhookMessage, PressedButton, SelectedMenu, SlashedCommand, SlashedSubCommand, EphemeralMessage, EphemeralResponseMessage
40+
from .receive import Interaction, InteractionType, Message, WebhookMessage, PressedButton, SelectedMenu, SlashedCommand, SlashedSubCommand, EphemeralMessage, EphemeralResponseMessage
4141

4242
from .override import override_dpy, override_dpy2_client
4343
override_dpy2_client()

discord_ui/receive.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -345,21 +345,18 @@ async def getMessage(state: ConnectionState, data, response = True):
345345
346346
Returns
347347
-------
348-
:class:`~Message` | :class:`~ResponseMessage`
348+
:class:`~Message` | :class:`~EphemeralMessage`
349349
The sent message
350-
351-
.. note::
352-
If the message comes from an interaction, it will be of type :class:`~ResponseMessage`, if it is sent to a textchannel, it will be of type :class:`~Message`
353350
"""
354351
channel = state.get_channel(int(data["channel_id"]))
355352
if response:
356-
if data.get("message") is not None and data["message"]["flags"] == 64:
357-
return EphemeralResponseMessage(state=state, channel=channel, data=data)
358-
return Message(state=state, channel=channel, data=data)
353+
if data.get("message") is not None and data.get("message", data)["flags"] == 64:
354+
return EphemeralResponseMessage(state=state, channel=channel, data=data.get("message", data))
355+
return Message(state=state, channel=channel, data=data.get("message", data))
359356

360357
if data.get("message") is not None and data["message"]["flags"] == 64:
361-
return EphemeralMessage(state=state, channel=channel, data=data["message"])
362-
return Message(state=state, channel=channel, data=data)
358+
return EphemeralMessage(state=state, channel=channel, data=data.get("message", data))
359+
return Message(state=state, channel=channel, data=data.get("message", data))
363360

364361
class Message(discord.Message):
365362
"""A fixed :class:`discord.Message` optimized for components"""
@@ -651,7 +648,7 @@ class EphemeralResponseMessage(Message):
651648
652649
Methods like `.edit()`, which change the original message, need a `token` paremeter passed in order to work
653650
"""
654-
def __init__(self, *, state, channel, data, user):
651+
def __init__(self, *, state, channel, data):
655652
Message.__init__(self, state=state, channel=channel, data=data)
656653

657654
async def edit(self, token, **fields):

docs/source/components.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,6 @@ Message
134134
.. autoclass:: Message()
135135
:members:
136136

137-
138-
ResponseMessage
139-
~~~~~~~~~~~~~~~~~~~~~~
140-
141-
.. autoclass:: ResponseMessage()
142-
:members:
143-
144-
145137
PressedButton
146138
~~~~~~~~~~~~~~~~~~~~~~
147139

0 commit comments

Comments
 (0)