N
N
Nikita Kudrin2020-09-06 10:57:55
Node.js
Nikita Kudrin, 2020-09-06 10:57:55

Incorrect code operation. How to fix?

Greetings.
Wrote the function of adding a user to the database with logging to the bot's server.
But he does not want to log.
The code:

if (!user) {
  User.create({
    guildID: message.guild.id,
    userID: message.author.id
  }); {
    const dbnuser = new Discord.MessageEmbed()
      .setColor('#0099ff')
      .setTitle('️DataBase Users Created')
      .setDescriprion(`**${message.author.username}** был добавлен в базу данных`)
      .addField(` ID Пользователя`, `**${message.author.id}**`)
      .setTimestamp()
      .setFooter('HHeller', 'https://pbs.twimg.com/profile_images/484250911162646529/kM2dke2__400x400.png')
    client.channels.chache.get("751906034716508242").send(dbnuser)
  }
}

Error code:
(node:2684) UnhandledPromiseRejectionWarning: TypeError: (intermediate value).setColor(...).setTitle(...).setDescriprion is not a function
    at Client.<anonymous> (/home/dcoder/music-bot-master/bot.js:41:6)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:2684) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2684) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Thank you in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-09-06
@HepkaPlay

I just have one question... what are those curly braces for?

{ // < //
    const dbnuser = new Discord.MessageEmbed()
      .setColor('#0099ff')
      .setTitle('️DataBase Users Created')
      .setDescriprion(`**${message.author.username}** был добавлен в базу данных`)
      .addField(` ID Пользователя`, `**${message.author.id}**`)
      .setTimestamp()
      .setFooter('HHeller', 'https://pbs.twimg.com/profile_images/484250911162646529/kM2dke2__400x400.png')
    client.channels.chache.get("751906034716508242").send(dbnuser)
} // < //

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question