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

TypeError: proxy is not a constructor #833

Closed dylan0356 closed 1 year ago

dylan0356 commented 1 year ago

Which package has the bugs?

The core library

Issue description

Tried to use a agent to set the clients proxy

/Users/dylanb/Documents/Github/DiscordBots/QuackSelfBot/node_modules/discord.js-selfbot-v13/src/client/websocket/WebSocketShard.js:284 args.agent = new proxy(client.options.proxy); ^

TypeError: proxy is not a constructor at /Users/dylanb/Documents/Github/DiscordBots/QuackSelfBot/node_modules/discord.js-selfbot-v13/src/client/websocket/WebSocketShard.js:284:22 at new Promise () at WebSocketShard.connect (/Users/dylanb/Documents/Github/DiscordBots/QuackSelfBot/node_modules/discord.js-selfbot-v13/src/client/websocket/WebSocketShard.js:208:12) at WebSocketManager.createShards (/Users/dylanb/Documents/Github/DiscordBots/QuackSelfBot/node_modules/discord.js-selfbot-v13/src/client/websocket/WebSocketManager.js:262:19) at WebSocketManager.connect (/Users/dylanb/Documents/Github/DiscordBots/QuackSelfBot/node_modules/discord.js-selfbot-v13/src/client/websocket/WebSocketManager.js:182:17) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Client.login (/Users/dylanb/Documents/Github/DiscordBots/QuackSelfBot/node_modules/discord.js-selfbot-v13/src/client/Client.js:354:7)

Node.js v18.16.0

Code sample

const { Client } = require("discord.js-selfbot-v13")
const HttpsProxyAgent = require("https-proxy-agent")

    var proxyy = proxies[Math.floor(Math.random() * proxies.length)]
    const agent = new HttpsProxyAgent(proxyy)

    const client = new Client(
        {
            captchaService: "capmonster",
            captchaKey: config.captchaKey.toString(),
            http: { agent: agent },
            captchaWithProxy: true,
            checkUpdate: false,
            proxy: proxyy,
            restRequestTimeout: 60 * 1000,
            interactionTimeout: 60 * 1000,
            restWsBridgeTimeout: 5 * 1000,
        }
    )

Package version

2.14.5

Node.js version

v18.16.0

Operating system

Mac OS

Priority this issue should have

Medium (should be fixed soon)

Checklist

Additional Information

No response

dylan0356 commented 1 year ago

Seems with this change I am still getting a proxy issue:

HTTPError [TypeError]: proxy is not a constructor at RequestHandler.execute (/Users/dylanb/Documents/Github/DiscordBots/QuackSelfBot/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:212:15) at RequestHandler.execute (/Users/dylanb/Documents/Github/DiscordBots/QuackSelfBot/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:216:19) at RequestHandler.push (/Users/dylanb/Documents/Github/DiscordBots/QuackSelfBot/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:62:25) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Client.fetchInvite (/Users/dylanb/Documents/Github/DiscordBots/QuackSelfBot/node_modules/discord.js-selfbot-v13/src/client/Client.js:584:18) at async Client.<anonymous> (/Users/dylanb/Documents/Github/DiscordBots/QuackSelfBot/index.js:40:13) { code: 500, method: 'get', path: '/invites/m49bvR4Q?with_counts=true&with_expiration=true', requestData: { json: undefined, files: [], headers: undefined } }

All I am trying to do is fetch and join an invite: ` for (let i = 0; i < serverInvites.length; i++) { const inviteCode = serverInvites[i];

        await client.fetchInvite(inviteCode).then(async (invite) => {
            await invite.acceptInvite(true).then(() => {
                console.log(chalk.green("Joined ") + gradient.cristal(invite.guild.name))
            }
            ).catch((err) => {
                console.log(err)
                console.log(chalk.red("Failed to join ") + gradient.cristal(invite.guild.name))
            }
            )
        }).catch((err) => {
            console.log(chalk.red("Failed to join ") + gradient.cristal(inviteCode))
            console.log(err)
        }
        )
    }`
aiko-chan-ai commented 1 year ago

fixed (2.14.11)