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

Button click not working as of 7th July 2022. #190

Closed Karewen closed 2 years ago

Karewen commented 2 years ago

Which package has the bugs?

The core library

Issue description

  1. For this example I have used the bot AniGame.
  2. Add AniGame to your discord server.
  3. Start journey using .start on the AniGame bot.
  4. Run the program.
  5. Spam in your discord server till a card spawns (or write a spam function)
  6. Expected behavior: Card spawns. Custom ID is logged. Button is clicked. Behavior: Card spawns. Custom ID is logged. Button is NOT clicked.
  7. The variable "done" returns undefined.
  8. No errors in console.
  9. If this is a general button click issue affecting all bots, this should be fixed ASAP.

Code sample

const ANIGAME_ID = "571027211407196161";

client.on('messageCreate', async message => {
    if (message.author.id === ANIGAME_ID && message.embeds.length > 0) {
        if (message.embeds[0].description.startsWith("*A wild")) {
            let custom_id = message.components[0].components[0].customId;
            console.log(custom_id);

            let done = await message.clickButton(custom_id);
            console.log(done);
        };
    };
});

Package version

discord.js-selfbot-v13@2.3.64

Node.js version

v18.2.0

Operating system

Windows

Priority this issue should have

High (immediate attention needed)

Checklist

Additional Information

No response

Karewen commented 2 years ago

I moved libraries from Discord S.C.U.M to this because I couldn't get button clicks to work on Discum. However, I am faced with the same issue on this library. This could have something to do with Discord changing something in their API. Regardless, this should be looked upon and fixed ASAP.

aiko-chan-ai commented 2 years ago

I moved libraries from Discord S.C.U.M to this because I couldn't get button clicks to work on Discum. However, I am faced with the same issue on this library. This could have something to do with Discord changing something in their API. Regardless, this should be looked upon and fixed ASAP.

Thank you for letting me know, I will proceed to debug and fix this

Karewen commented 2 years ago

I moved libraries from Discord S.C.U.M to this because I couldn't get button clicks to work on Discum. However, I am faced with the same issue on this library. This could have something to do with Discord changing something in their API. Regardless, this should be looked upon and fixed ASAP.

Thank you for letting me know, I will proceed to debug and fix this

Thank you for your earliest response. Before you dive deep into this, I have tried the self-bot part with a fresh account that is only in one server; it worked like a charm. The account I was using previously was in several servers with the Anigame bot. With the information given, is it possible for you to describe what went wrong?

Great library by the way, only found about this today and I am hooked. I can finally say goodbye to Python for some time now.

GillHoang commented 2 years ago
message.embeds.forEach(async e => {
      if(!e.title) return;
      if(!e.footer) return;
      if(e.title.includes("What's this?") && e.footer.text.includes(`Click on the claim button first to claim this card!`)) {
        const label = 'Claim!'
        const row = message.components[0];
        const button = row.components.find(button_ => button_.label
        == label);
        if(!button) return;
        button.click(message);
        const hook = new WebhookClient({ url: config.webhook });
        const d = new Date();
        const x = d/1000;
        hook.send(`<t:${Math.floor(x)}t:> | Claimed card in [${message.channel.name}](${message.channel.url})`)
        console.log(`Claimed card in ${message.channel.name}`)
      }
    })

hmmm u can try this

aiko-chan-ai commented 2 years ago

@Karewen I've tweaked the response data a bit, it will return a Snowflake which you can check with events https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Documents/SlashCommand.md#events You can check when the button is interacted, the interactionCreate event is emitted Then check for events interactionFailure and interactionSuccess Pay attention to the nonce data, that is Snowflake when the interaction is created It's all in the documentation https://discordjs-self-v13.netlify.app/#/

Karewen commented 2 years ago

Working now, I will close this issue. Thanks.