Read information from embed message Discord.JS

I want my keytritz bot to react to an embed when the title is naruto / Naruto but in the first one I got an error (# 1) but it did not affect the functionality but in the second embed (#2) I got an error that the keytritz bot did not react and did not commented
, I leave a link where is the code of both bots, the mudae bot is not mine.

CODE Keytritz:

      for(var i = 0; i < message.embeds.length; i++) {;
              message.react(" ")

Embed lxXxandresxXxl

  if(message.content.startsWith(prefix+"r")) {{ embed: {
      color: 3447003,
      author: {
        name: client.user.username,
        icon_url: client.user.displayAvatarURL()
      title: "This is an naruto embed",
      url: "",
      description: "This is a test embed to showcase what they look like and what they can do.",
      fields: [{
        name: "Fields",
        value: "They can have different fields with small headlines."
        name: "Masked links",
        value: "You can put [masked links]( inside of rich embeds."
        name: "Markdown",
        value: "You can put all the *usual* **__Markdown__** inside of them."
      timestamp: new Date(),
      footer: {
        icon_url: client.user.displayAvatarURL(),
        text: "© Example"

Error 1#

(node:1744) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
        at RequestHandler.execute (/rbd/pnpm-volume/8bd4e7c9-1711-40fc-be45-7d082848ec2a/node_modules/
        at processTicksAndRejections (internal/process/task_queues.js:88:5)
        at async RequestHandler.push (/rbd/pnpm-volume/8bd4e7c9-1711-40fc-be45-7d082848ec2a/node_modules/
    (node:1744) 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(). (rejection id: 1)
    (node:1744) [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.

Error 2#

TypeError: Cannot read property 'includes' of null
at Client.<anonymous> (/app/server.js:90:36)
    at Client.emit (events.js:196:13)
    at MessageCreateAction.handle (/rbd/pnpm-volume/8bd4e7c9-1711-40fc-be45-7d082848ec2a/node_modules/
    at Object.module.exports [as MESSAGE_CREATE] (/rbd/pnpm-volume/8bd4e7c9-1711-40fc-be45-7d082848ec2a/node_modules/
    at WebSocketManager.handlePacket (/rbd/pnpm-volume/8bd4e7c9-1711-40fc-be45-7d082848ec2a/node_modules/
    at WebSocketShard.onPacket (/rbd/pnpm-volume/8bd4e7c9-1711-40fc-be45-7d082848ec2a/node_modules/
    at WebSocketShard.onMessage (/rbd/pnpm-volume/8bd4e7c9-1711-40fc-be45-7d082848ec2a/node_modules/
    at WebSocket.onMessage (/rbd/pnpm-volume/8bd4e7c9-1711-40fc-be45-7d082848ec2a/node_modules/
    at WebSocket.emit (events.js:196:13)
    at Receiver.receiverOnMessage (/rbd/pnpm-volume/8bd4e7c9-1711-40fc-be45-7d082848ec2a/node_modules/

I’m always a little surprised when people use Glitch support for things like Discord bot issues. Wouldn’t it be wise to check the Discord.Js discord server? In both error messages however the immediate error is displayed. You cannot send an empty message and the title property is null. I’d guess that embeds[i] is null in that case.

Add console.log statements where they can confirm the values you think you have.

1 Like