0

I am trying to access messages from in Nodejs (discord.js)

{
    "627832600865800222": {                 //guild id
        "348832732647784460": {             // author id
            "message": "hii hello"
        }
    }
}
let author_id = message.author.id
let guild_id = message.guild.id
let out = msg [guild_id].author_id.message 
        console.log(out)

expected output : hii hello

but resultant output : undefined after guild_id the output is undefined

Root Android
  • 46
  • 1
  • 6

1 Answers1

-1

Change let out = msg [guild_id].author_id.message

to let out = msg[guild_id][author_id].message

MDN documentation reference for property accessors: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors

Samuel Reid
  • 1,756
  • 12
  • 22