Sopur / Discord-user-bots

Working discord user bots library.
MIT License
80 stars 34 forks source link

Add support for buttons #26

Open Rider21 opened 2 years ago

Rider21 commented 2 years ago

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

Sopur commented 2 years ago

Buttons are only possible for normal bots, not users.

Rider21 commented 2 years ago

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

Themis3000 commented 1 year ago

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.

Sopur commented 1 year ago

I will look into it.

Lizard-King101 commented 1 year ago

any update on this?

CyberNinja2007 commented 1 year ago

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: {

} }` Hope this helps.