Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

134
Visualizações
Discord Bot outputting nothing client.on('ready')

Basically, when I run node . in my command prompt nothing is outputted.

My code:

const Discord = require("discord.js");

const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] });

client.on("ready", () => {
    console.log(`Logged in as ${client.user.tag}`);
});
//My key is located here but I've taken it out for obvious reasons
client.login = "key";
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

client.login = ('key');

If that is how your code looks and isn't just a typo in the question, that is invalid syntax. client.login() is a method. This is how it should look:

client.login('key');

That is most likely your issue.

about 4 years ago · Juan Pablo Isaza Relatório

0


Hello there Justin 👋

Your following code contains false syntax.

client.login = "key" //Will create errors.
client.login("key") //Will not create errors.

Also, I would recommend you to install dotenv from the npm package database. Its safer and barely needs any coding experience.

Just look at the difference

client.login("key") //Can see your token
require('dotenv').config();
client.login(process.env.key) //Cant see your token unless i see your .env

Just simply install the package running npm i dotenv, then create a file .env and inside that file have your enviromental variables.

key = token

I hope this helped you. Oh also if your bot is on GitHub make sure to add a .gitignore file so it cant be accessed by other users.

//.gitignore file

.env //This is the file you want hidden

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda