Discord-user-bots icon indicating copy to clipboard operation
Discord-user-bots copied to clipboard

Add support for buttons

Open Rider21 opened this issue 2 years ago • 6 comments

I noticed that there is no support for button interactions изображение

Rider21 avatar May 09 '22 15:05 Rider21

Buttons are only possible for normal bots, not users.

Sopur avatar May 12 '22 21:05 Sopur

I mean by pressing a button rather than sending it in a message

Rider21 avatar May 13 '22 13:05 Rider21

Seconded. I'd like to run e2e automated tests against a discord bot of mine, but part of what I have to test is interactions in a dm channel. Using a automated userbot to test to bot seems the only way to approach true e2e automated tests. It seems the only thing in the way of using this library for the purpose I want is support for interactions.

Themis3000 avatar Oct 07 '22 20:10 Themis3000

I will look into it.

Sopur avatar Oct 08 '22 16:10 Sopur

any update on this?

Lizard-King101 avatar Jan 28 '23 21:01 Lizard-King101

I managed to push the buttons as well as send the slash commands through the client.fetch_request(), if I understand it right, all the slash commands and buttons are interactions, so you need to go to the web version of Discord, open the network and send the slash command and you should see the post request that is sended to 'interactions' url and with that you can do client.fetch_request(). For buttons you need to get the message from bot through the client.on.message_create() and there you need to look at the components of this message, this components will be the buttons id. Next, you need to go to the browser again and click on some button and in the network tab you again will see the 'interactions' request. All you need to do is to send it like it was with the slash command through the client.fetch_request() For example: const answer = await client.fetch_request( 'interactions', { method: 'POST', body: { <THE BODY OF THE REQUEST FROM WEB DISCORD> } } Hope this helps.

CyberNinja2007 avatar May 03 '23 08:05 CyberNinja2007