Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

248
Views
El bot de Discord no muestra el "mensaje de éxito" en Visual Studio Code
const Discord = require('discord.js'); // fs const fs = require('fs'); // path const path = require('path'); // config const config = require('./config.json'); // config.json const token = config.token; // config config.json const PREFIX = config.prefix; const { Client, Intents } = require('discord.js'); const client = new Client({ intents: \[Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES\] }) client.commands = new Discord.Collection(); // message client.on('message', message =\> { // message not sent by bot if (!message.author.bot) { // if the message starts with the prefix if (message.content.startsWith(PREFIX)) { // split the message into an array const args = message.content.slice(PREFIX.length).split(/ +/); // command is the first element of the array const command = args.shift().toLowerCase(); // ping command if (command === 'ping') { // send a message to the channel message.channel.send('pong'); } // success message after login client.on('ready', () =\> { console.log(`Logged in as ${client.user.tag}!`); }) // token config file client.login(config.token);

así que ejecuto el nodo index.js, se supone que debe mostrarse como "mi nombre de bot aquí" en la terminal VSC y debería estar en línea en la discordia, pero no es así y no puedo resolverlo.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El formateo te salvará la vida, Bro: Además, recomendaría menos comentarios. Es mucho ruido. Refactoricé estas cosas. Mira cuánto mejor se ve tu código:

 const { token, prefix: PREFIX } = require('./config.json'); const { Collection, Client, Intents } = require('discord.js'); const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }) client.commands = new Collection(); client.on('message', message => { if (message.author.bot) return if (!message.content.startsWith(PREFIX)) return const args = message.content.slice(PREFIX.length).split(' '); const command = args.shift().toLowerCase(); if (command === 'ping') { message.channel.send('pong'); } }) client.on('ready', () => { console.log(`Logged in as ${client.user.tag}!`); }) client.login(token);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!