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

282
Views
How to make register command on discord.js and mongodb atlas?

I want to save my discord member data using register command, please help me!!

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>",
    })
  }
})

And this is the schema look like 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

From what I understood, because your question is not clear at all You need to add collection to your db using mongoose when command !register is run.

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'})

This is how you save data with 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!