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

276
Views
¿Cómo hacer un comando de registro en discord.js y mongodb atlas?

¡Quiero guardar los datos de mi miembro de Discord usando el comando de registro, por favor ayúdenme!

bot.js

 client.on("message", msg => { if (msg.content === "!register, ign:<input from member>, level:<input from member>"){ const newProfileSchema = new ProfileSchema({ discordid: "Discord Member Username", ign: "<input from member>", level: "<input from member>", }) } })

Y este es el esquema que se parece a Schema.js

 const mongoose = require('mongoose'); const Schema = mongoose.Schema; const ProfileSchema = new Schema({ discordid: { type: String, required: true }, ign: { type: String }, level: { type: Number } }); module.exports = User = mongoose.model('profile', ProfileSchema);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Por lo que entendí, debido a que su pregunta no está del todo clara, debe agregar una colección a su base de datos usando mongoose cuando se ejecuta el comando !register .

 const ign = args.slice(1).join(" ") const level = args.slice.... // same thing const newSchemaprofile = new Schema({ discordid: message.author.id, ign: ign, level: level, }).save(); message.reply({content: 'Your data is saved'})

Así es como guardas datos con mongoose

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!