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
755 stars 160 forks source link

client.emit('error', new Error(`[USER_REQUIRED_ACTION] ${msg}`)); #957

Closed Yusufkulcu closed 8 months ago

Yusufkulcu commented 8 months ago

Which package has the bugs?

The core library

Issue description

After logging into the account, if there is an issue during the login process, it throws the error below and the console closes. I want it to only show the error without closing the console. How can I achieve this?

Code sample

async function CheckToken(token, useproxy = false) {
    let client;
    try {
        if (useproxy === true) {
            const connectProxy = new HttpsProxyAgent({
                host: getConfigData().proxyhost,
                port: getConfigData().proxyport,
                username: getConfigData().proxyusername,
                password: getConfigData().proxypassword,
                auth: `${getConfigData().proxyusername}:${getConfigData().proxypassword}`
            });
            client = new Client({
                checkUpdate: false,
                captchaService: "capmonster",
                captchaKey: getConfigData().capmonsterkey,
                captchaWithProxy: true,
                http: {agent: connectProxy}
            });
        } else {
            client = new Client({
                checkUpdate: false
            });
        }

        const login = await client.login(token)
        const username = client.user.username
        client.on('ready', async () => {
            await client.destroy()
        })
        return {
            status: true,
            message: "Token aktif durumda",
            username: username
        }
    } catch (error) {
        return {
            status: false, message: "Token pasif durumda"
        }
    }
}

Package version

2.15.0

Node.js version

Node.js v20.10.0

Operating system

Windows 11

Priority this issue should have

High (immediate attention needed)

Checklist

Additional Information

No response

Yusufkulcu commented 8 months ago

Error image

image

VillainsRule commented 8 months ago

You can just set an interval for a long time.

setInterval(() => false, 1 << 12);

If you don't like that, start an HTTP server on a random unused port.

Neither of these should be used in production, for obvious reasons. I don't see why you would want to keep the terminal open in the first place, but this should work for now.

Yusufkulcu commented 8 months ago

You can just set an interval for a long time.

setInterval(() => false, 1 << 12);

If you don't like that, start an HTTP server on a random unused port.

Neither of these should be used in production, for obvious reasons. I don't see why you would want to keep the terminal open in the first place, but this should work for now.

Where should I use this function? The reason I don't want the console to remain open is that I am performing account verification. When such a problem arises, the console closes, and the process does not continue to other accounts, leaving the operation incomplete.

aiko-chan-ai commented 8 months ago
client.on('error', () => false)
Yusufkulcu commented 8 months ago
client.on('error', () => false)

Where should I use this?

aiko-chan-ai commented 8 months ago

        client.on('ready', async () => {
            await client.destroy()
        }).on('error', () => false)```
Yusufkulcu commented 8 months ago
client.on('ready', async () => {
            await client.destroy()
        }).on('error', () => false)```

unfortunately it didn't happen :(

image

image

aiko-chan-ai commented 8 months ago

edit from

const login = await client.login(token)
        const username = client.user.username
        client.on('ready', async () => {
            await client.destroy()
        })

to

      client.on('ready', async () => {
            await client.destroy()
        }).on('error', () => false)
const login = await client.login(token)
        const username = client.user.username
Yusufkulcu commented 8 months ago

edit from

const login = await client.login(token)
        const username = client.user.username
        client.on('ready', async () => {
            await client.destroy()
        })

to

      client.on('ready', async () => {
            await client.destroy()
        }).on('error', () => false)
const login = await client.login(token)
        const username = client.user.username

It happened like this, but even when it encounters account verification during login, I don't receive an error stating that the account is inactive because it logs into the account. How can I solve this issue?

Yusufkulcu commented 8 months ago

Except for the issue mentioned above, I'm experiencing the error in the image. What could be the problem?

HTTPError [DiscordjsError]: Request to use token, but token was unavailable to the client.

WhatsApp Görsel 2023-12-21 saat 20 22 33_75828b1a

Yusufkulcu commented 8 months ago

edit from

const login = await client.login(token)
        const username = client.user.username
        client.on('ready', async () => {
            await client.destroy()
        })

to

      client.on('ready', async () => {
            await client.destroy()
        }).on('error', () => false)
const login = await client.login(token)
        const username = client.user.username

image

I wonder what might be causing this error; I'm getting this error during the server joining process. The account is active. I can directly log into the server via the Discord application. I would be very grateful if you could help

aiko-chan-ai commented 8 months ago

try updating to v3

yufusphp commented 8 months ago

try updating to v3

I don't understand

aiko-chan-ai commented 8 months ago

const Discord = require('discord.js-selfbot-v13'); // v3.0.0
const Captcha = require('2captcha');
const solver = new Captcha.Solver('key');

const client = new Discord.Client({
    captchaSolver: function (captcha, UA) {
        return solver
            .hcaptcha(captcha.captcha_sitekey, 'discord.com', {
                invisible: 1,
                userAgent: UA,
                data: captcha.captcha_rqdata,
            })
            .then((res) => res.data);
    },
});

client.on('ready', async () => {
    console.log('Ready!', client.user.tag);
    client.acceptInvite('mdmc');
});

client.login('token');
yufusphp commented 8 months ago
const Discord = require('discord.js-selfbot-v13'); // v3.0.0
const Captcha = require('2captcha');
const solver = new Captcha.Solver('key');

const client = new Discord.Client({
  captchaSolver: function (captcha, UA) {
      return solver
          .hcaptcha(captcha.captcha_sitekey, 'discord.com', {
              invisible: 1,
              userAgent: UA,
              data: captcha.captcha_rqdata,
          })
          .then((res) => res.data);
  },
});

client.on('ready', async () => {
  console.log('Ready!', client.user.tag);
  client.acceptInvite('mdmc');
});

client.login('token');

Thank you, I will try it, I would be very grateful if you could help me with the following problem.

https://github.com/aiko-chan-ai/discord.js-selfbot-v13/issues/961

Yusufkulcu commented 8 months ago
captchaSolver: function (captcha, UA) {
      return solver
          .hcaptcha(captcha.captcha_sitekey, 'discord.com', {
              invisible: 1,
              userAgent: UA,
              data: captcha.captcha_rqdata,
          })
          .then((res) => res.data);
  },

How can I use this method with capmonster?

aiko-chan-ai commented 8 months ago

Which library do you want to use? image

Yusufkulcu commented 8 months ago

Which library do you want to use? image

node-capmonster

aiko-chan-ai commented 8 months ago
const { HCaptchaTask } = require('node-capmonster');
const solver = new HCaptchaTask('api_key');

const client = new Discord.Client({
    captchaSolver: function (captcha, UA) {
        const task = solver.task({
            websiteKey: captcha.captcha_sitekey,
            websiteURL: 'discord.com',
            isInvisible: true,
            data: captcha.captcha_rqdata,
        });
        return solver
            .createWithTask(task)
            .then((taskId) => solver.joinTaskResult(taskId))
            .then((response) => response.gRecaptchaResponse);
    },
});
Yusufkulcu commented 8 months ago
const { HCaptchaTask } = require('node-capmonster');
const solver = new HCaptchaTask('api_key');

const client = new Discord.Client({
  captchaSolver: function (captcha, UA) {
      const task = solver.task({
          websiteKey: captcha.captcha_sitekey,
          websiteURL: 'discord.com',
          isInvisible: true,
          data: captcha.captcha_rqdata,
      });
      return solver
          .createWithTask(task)
          .then((taskId) => solver.joinTaskResult(taskId))
          .then((response) => response.gRecaptchaResponse);
  },
});

I get this error

image

Yusufkulcu commented 8 months ago

How can I solve the above problem?

const { HCaptchaTask } = require('node-capmonster');
const solver = new HCaptchaTask('api_key');

const client = new Discord.Client({
  captchaSolver: function (captcha, UA) {
      const task = solver.task({
          websiteKey: captcha.captcha_sitekey,
          websiteURL: 'discord.com',
          isInvisible: true,
          data: captcha.captcha_rqdata,
      });
      return solver
          .createWithTask(task)
          .then((taskId) => solver.joinTaskResult(taskId))
          .then((response) => response.gRecaptchaResponse);
  },
});

How can I solve the above problem?

image

aiko-chan-ai commented 8 months ago

maybe capmonster requires full URL, try with https://discord.com