admin管理员组

文章数量:1332377

OK so before I get 500 ments about self bots being against TOS I already know that and I am ready to accept the risk. So I have made other selfbots about 3-4 years ago before most libraries stopped supporting it and I would like to know is there a way I can make this code to accept a user token and log in?

const { Client } = require("discord.js");
const client = new Client({
   disableEveryone: true
});
const config = require("./config.json");

var prefix = config.prefix;


client.on('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);
  });

  client.on('message', msg => {
    if(msg.author !== client.user) return;



  if (msg.content.startsWith(prefix + 'bump')) {
      msg.delete()
msg.channel.send(`**hello `)
}

OK so before I get 500 ments about self bots being against TOS I already know that and I am ready to accept the risk. So I have made other selfbots about 3-4 years ago before most libraries stopped supporting it and I would like to know is there a way I can make this code to accept a user token and log in?

const { Client } = require("discord.js");
const client = new Client({
   disableEveryone: true
});
const config = require("./config.json");

var prefix = config.prefix;


client.on('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);
  });

  client.on('message', msg => {
    if(msg.author !== client.user) return;



  if (msg.content.startsWith(prefix + 'bump')) {
      msg.delete()
msg.channel.send(`**hello `)
}
Share Improve this question edited Mar 28, 2020 at 17:44 haldo 16.7k8 gold badges55 silver badges59 bronze badges asked Mar 28, 2020 at 17:30 bellamybellamy 11 gold badge1 silver badge1 bronze badge
Add a ment  | 

4 Answers 4

Reset to default 2

If you're using chrome you can open up the developer tools, go to the network tab, filter by "XHR", reload the page, find the request to /api/v6/gateway or any other url under /api, then look at the headers and find the authorization header to get your token. Then, use the token as normal.

Instead of using discord.js just do

npm i discord.js-selfbot 

Which is just like discord.js v12 but that allows the use of selfbots.

As with many discord.js answers, they are deprecated with version 12. Since v12 removed support for selfbots, try the npm package discord.js-self. It works exactly like discord.js, except it only supports logging in using a normal account's authorization token.

Self-bots where removed in v12.

To install the latest v11 release, use the following mand:

yarn add discord.js@11

The problem with using other packages is that typings may not be available, while they work when using the official package.

本文标签: javascriptDISCORD selfbot in JSStack Overflow