@HepkaPlay
JavaScript Junior.

Некорректная работа кода. Как исправить?

Приветствую.
Написал функцию добавления пользователя в базу данных с логированием в оф.сервер бота.
Но он не хочет логировать.
Код:
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)
  }
}

Код ошибки:
(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.

Заранее спасибо за помощь.
  • Вопрос задан
  • 915 просмотров
Решения вопроса 1
Alexandre888
@Alexandre888 Куратор тега Боты
Javascript-разработчик
у меня только один вопрос... для чего эти фигурные скобки?
{ // < //
    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)
} // < //
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы