aiko-chan-ai / discord.js-selfbot-v13

An unofficial discord.js fork for creating selfbots
https://discordjs-self-v13.netlify.app
GNU General Public License v3.0
751 stars 160 forks source link

How do I make it click on buttons? #602

Closed gif12 closed 1 year ago

gif12 commented 1 year ago

How do I make it click on buttons?‌ I tried to do this but failed But I have managed to create multiple logins and also send slash commands code :

const { Client } = require('discord.js-selfbot-v13');
const client = new Client({
    // See other options here
    // https://discordjs-self-v13.netlify.app/#/docs/docs/main/typedef/ClientOptions
    // All partials are loaded automatically
});

client.on('ready', async () => {
  console.log(`${client.user.username} is ready!`);
})

message.channel.sendSlash('1089233628531261510', 'kar', '1000000')
message.clickButton({ row: 1, col: 1})

client.login('token');
NekoCyan commented 1 year ago

You are using right method to click a button, but are you sure about row and col are in the right position?

Row and col will starts at position 0, meaning if there is only has one button, row and col will be 0. And if there's also has only a one button, you can just put .clickButton() with no params (Message must be defined). Docs: Message.clickButton([button]).

One more, later please post your question in discussion section of this repo, not in this issues section.

gif12 commented 1 year ago

That is, if we have only one row of buttons and we want to click on the second button in that row, it's as follows?

const { Client } = require('discord.js-selfbot-v13');
const client = new Client({
    // See other options here
    // https://discordjs-self-v13.netlify.app/#/docs/docs/main/typedef/ClientOptions
    // All partials are loaded automatically
});

client.on('ready', async () => {
  console.log(`${client.user.username} is ready!`);
})

message.channel.sendSlash('1089233628531261510', 'kar', '1000000')

client.on('messageCreate', async message => {
 if (message.components.length) {
    message.clickButton({ row: 1, col: 0 });
 }
});

client.login('token');
aiko-chan-ai commented 1 year ago

row 0 col 1