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
799 stars 169 forks source link

Not working under electron build #624

Closed 1stdevfriend closed 1 year ago

1stdevfriend commented 1 year ago

Which package has the bugs?

The core library

Issue description

  1. Create any electron project and import this library
  2. It's working fine under dev mode
  3. If you pack it using electron builder. It's not working

Code sample

export const getTokenType = async (token: string, cb: (data: any) => void) => {
  try {
    if (token) {
      console.log('----->', token);
      const client = new Client({
        // checkUpdate: false,
      });
      client
        .login(token)
        .then((data: any) => {})
        .catch((e: any) => {
          mainWindow?.webContents?.send('debug-channel', 'login msg:-' + e);
          cb(null);
        });

      client.on('ready', async () => {
        if (client?.user?.username) cb({ name: client?.user?.username });
        else cb(null);
      });
    } else cb(null);
  } catch (error) {
    mainWindow?.webContents?.send('debug-channel', 'err msg:-' + error);
    cb(null);
  }
};

Package version

discord.js-selfbot-v13@2.13.3

Node.js version

18.15.0

Operating system

Windows

Priority this issue should have

Medium (should be fixed soon)

Checklist

Additional Information

No response

aiko-chan-ai commented 1 year ago

can you give me the error code?

1stdevfriend commented 1 year ago

That's what I'm getting via catch block @aiko-chan-ai

login msg:-TypeError: Cannot destructure property 'url' of '(intermediate value)' as it is undefined

1stdevfriend commented 1 year ago

This when I try to get channel name from selfbot image

aiko-chan-ai commented 1 year ago

Is it a voice channel or a text channel?

1stdevfriend commented 1 year ago

Text channel

On Thu, 20 Apr, 2023, 16:50 Elysia, @.***> wrote:

Is it a voice channel or a text channel?

β€” Reply to this email directly, view it on GitHub https://github.com/aiko-chan-ai/discord.js-selfbot-v13/issues/624#issuecomment-1516152920, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGU6Q6A4HCEDHZVKCBWRSSTXCELWHANCNFSM6AAAAAAXD5Q7AU . You are receiving this because you authored the thread.Message ID: @.***>

aiko-chan-ai commented 1 year ago

can i have the code you are using?

1stdevfriend commented 1 year ago

Sure, I'll be adding you to the repo. Please don't fork or make it public

On Thu, 20 Apr, 2023, 18:13 Elysia, @.***> wrote:

can i have the code you are using?

β€” Reply to this email directly, view it on GitHub https://github.com/aiko-chan-ai/discord.js-selfbot-v13/issues/624#issuecomment-1516262131, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGU6Q6AFVRIHUG4APBKN6HTXCEVPHANCNFSM6AAAAAAXD5Q7AU . You are receiving this because you authored the thread.Message ID: @.***>

aiko-chan-ai commented 1 year ago

you can also make a simple version

Xtendera commented 1 year ago

This might be an issue within electron, as it can sometimes be buggy with external libraries. I was using some obscure library from npm at one point with it, and the app just refused to launch.

1stdevfriend commented 1 year ago

Added you in the repo. Please take a look @aiko-chan-ai

1stdevfriend commented 1 year ago

This might be an issue within electron, as it can sometimes be buggy with external libraries. I was using some obscure library from npm at one point with it, and the app just refused to launch.

I've tried a boilerplate version with minimum amount of modules but still getting the same problem.

aiko-chan-ai commented 1 year ago

Added you in the repo. Please take a look @aiko-chan-ai

can you tell me the url of the repo?

1stdevfriend commented 1 year ago

Sure.

https://github.com/koders-in/X12-Mirror

You can accept invitation via email as well.

aiko-chan-ai commented 1 year ago

image

@1stdevfriend 2000 years later ...

aiko-chan-ai commented 1 year ago

image

@1stdevfriend ok πŸ’€

aiko-chan-ai commented 1 year ago

image

aiko-chan-ai commented 1 year ago

~~maybe I'll wait until my network is better (Internet in Vietnam is pretty bad at night)~~ @1stdevfriend Can you make a simplified version of it? I can't build it πŸ’€

erxson commented 1 year ago

Same error. I just installed npm module and tried to start DiscordClientRPC example from docs and received this error

/home/container/node_modules/discord.js-selfbot-v13/src/client/websocket/WebSocketManager.js:143
    const { url } = await this.client.api.gateway
            ^
TypeError: Cannot destructure property 'url' of '(intermediate value)' as it is undefined.
    at WebSocketManager.connect (/home/container/node_modules/discord.js-selfbot-v13/src/client/websocket/WebSocketManager.js:143:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Client.login (/home/container/node_modules/discord.js-selfbot-v13/src/client/Client.js:354:7)

Or should I open a separate issue?

Also tried this code https://pastes.dev/jy5S49fNmU

aiko-chan-ai commented 1 year ago

Which version of electron are you using?

1stdevfriend commented 1 year ago

Same error. I just installed npm module and tried to start DiscordClientRPC example from docs and received this error

/home/container/node_modules/discord.js-selfbot-v13/src/client/websocket/WebSocketManager.js:143
    const { url } = await this.client.api.gateway
            ^
TypeError: Cannot destructure property 'url' of '(intermediate value)' as it is undefined.
    at WebSocketManager.connect (/home/container/node_modules/discord.js-selfbot-v13/src/client/websocket/WebSocketManager.js:143:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Client.login (/home/container/node_modules/discord.js-selfbot-v13/src/client/Client.js:354:7)

Or should I open a separate issue?

Also tried this code https://pastes.dev/jy5S49fNmU

Yeah that's the exact error I'm having. @erxson

erxson commented 1 year ago

I have such problem without electron. I just created js file, put example code and run with nodemon bot. Clean pterodactyl container with latest nodemon + node 16. @aiko-chan-ai

aiko-chan-ai commented 1 year ago

try the latest update on github

erxson commented 1 year ago

try the latest update on github

Didn't work. Same error.

1stdevfriend commented 1 year ago

@aiko-chan-ai Tried the latest npm i discord.js-selfbot-v13 Still getting TypeError: Cannot destructure property 'url' of '(intermediate value)' as it is undefined.

erxson commented 1 year ago

@aiko-chan-ai Tried the latest npm i discord.js-selfbot-v13 Still getting TypeError: Cannot destructure property 'url' of '(intermediate value)' as it is undefined.

He most likely meant the latest commit, not release. Anyway it didn't work

aiko-chan-ai commented 1 year ago

try again in latest commit

erxson commented 1 year ago

fixed. Thank you!

erxson commented 1 year ago

New error now XD

/home/container/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:212
        throw new HTTPError(error.message, error.constructor.name, error.status, request);
              ^
HTTPError [TypeError]: Cannot assign to read only property 'defaultCipherList' of object '[object Object]'
    at RequestHandler.execute (/home/container/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:212:15)
    at RequestHandler.execute (/home/container/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:216:19)
    at RequestHandler.push (/home/container/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:62:25)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async MessageManager.delete (/home/container/node_modules/discord.js-selfbot-v13/src/managers/MessageManager.js:234:5)
    at async Message.delete (/home/container/node_modules/discord.js-selfbot-v13/src/structures/Message.js:833:5) {
  code: 500,
  method: 'delete',
  path: '/channels/1089899806647930941/messages/1100096567379238982',
  requestData: { json: undefined, files: [], headers: undefined }
}

I should open new issue for this?

aiko-chan-ai commented 1 year ago

i hate electron + try again in latest commit

aiko-chan-ai commented 1 year ago

electron's built-in nodejs has too many bugs

aiko-chan-ai commented 1 year ago

i just implemented a simple JA3 shuffling algorithm πŸ’€

erxson commented 1 year ago

New error now XD

/home/container/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:212
        throw new HTTPError(error.message, error.constructor.name, error.status, request);
              ^
HTTPError [TypeError]: Cannot assign to read only property 'defaultCipherList' of object '[object Object]'
    at RequestHandler.execute (/home/container/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:212:15)
    at RequestHandler.execute (/home/container/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:216:19)
    at RequestHandler.push (/home/container/node_modules/discord.js-selfbot-v13/src/rest/RequestHandler.js:62:25)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async MessageManager.delete (/home/container/node_modules/discord.js-selfbot-v13/src/managers/MessageManager.js:234:5)
    at async Message.delete (/home/container/node_modules/discord.js-selfbot-v13/src/structures/Message.js:833:5) {
  code: 500,
  method: 'delete',
  path: '/channels/1089899806647930941/messages/1100096567379238982',
  requestData: { json: undefined, files: [], headers: undefined }
}

I should open new issue for this?

same error

aiko-chan-ai commented 1 year ago

:?

1stdevfriend commented 1 year ago

Same error :/ @aiko-chan-ai @erxson

HTTPError [TypeError]: Cannot assign to read only property 'defaultCipherList' of object '[object Object]'

aiko-chan-ai commented 1 year ago

I really don't understand why this error only happens with Electron I have tried nodejs versions from v10 to v20.0.0 and no error

1stdevfriend commented 1 year ago

Should I upload a sample code for testing?

aiko-chan-ai commented 1 year ago

try again in latest commit I hope this error goes away

erxson commented 1 year ago

I really don't understand why this error only happens with Electron I have tried nodejs versions from v10 to v20.0.0 and no error

I have such issue without electron

erxson commented 1 year ago

I dont even know what exact is electron

erxson commented 1 year ago

try again in latest commit I hope this error goes away

works now. Thank you again!

1stdevfriend commented 1 year ago

Awesome work @aiko-chan-ai! Gonna test now! 🀞

1stdevfriend commented 1 year ago

Good news: image The token is returning my username so it kinda is logging.

Bad news: This πŸ‘‡ image image

1stdevfriend commented 1 year ago

Can you push the lib to npm? Maybe i did something wrong while installing it.

aiko-chan-ai commented 1 year ago

try disabling asar

1stdevfriend commented 1 year ago

Nope image

jsardev commented 1 year ago

try again in latest commit

@aiko-chan-ai Thank you a lot for the fix -- any plans to publish it to npm? πŸ™ I'm getting it on a plain node.js TypeScript project as well (I mean the url destructuring error) πŸ˜…

aiko-chan-ai commented 1 year ago

try again in latest commit

@aiko-chan-ai Thank you a lot for the fix -- any plans to publish it to npm? πŸ™ I'm getting it on a plain node.js TypeScript project as well (I mean the url destructuring error) πŸ˜…

v2.13.6