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

Commit 5eb49b9

Browse files
author
kuso-senpai
committed
response issue fixed
1 parent 0e250c6 commit 5eb49b9

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,14 @@ Added events for `client.wait_for` and `client.listen`
616616

617617
# Changelog
618618

619+
620+
- <details>
621+
<summary>1.0.5</summary>
622+
623+
### **Fixed**
624+
- `ResponseMessage.respond()`
625+
> responding now doesn't fail after sending the message, it will now acknowledge the interaction by it self if not already acknowledged and then send the message
626+
619627
- <details>
620628
<summary>1.0.4</summary>
621629

discord_py_buttons/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
from .buttons import Button, LinkButton, Colors
33
from .receive import ResponseMessage, Message, PressedButton
44

5-
__version__ = "1.0.3"
5+
__version__ = "1.0.5"

discord_py_buttons/receive.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,10 @@ async def respond(self, content=None, *, tts=False, embed = None, embeds=None, f
420420
if not ninjaMode:
421421
json = jsonifyMessage(content=content, tts=tts, embed=embed, embeds=embeds, file=file, files=files, nonce=nonce, allowed_mentions=allowed_mentions, reference=discord.MessageReference(message_id=self.id, channel_id=self.channel.id), mention_author=mention_author, buttons=buttons)
422422
r = POST(token=self._discord.http.token, URL=(url + f"/channels/{self.channel.id}/messages"), data=json)
423+
424+
if not self.acknowledged:
425+
# Preventing the interaction to fail while fetching the channel
426+
self.acknowledge()
423427
msg = await getResponseMessage(self._discord, r.json(), response=False)
424428

425429
r = POST(self._discord.http.token, f'https://discord.com/api/v8/interactions/{self.pressedButton.interaction["id"]}/{self.pressedButton.interaction["token"]}/callback', {

0 commit comments

Comments
 (0)