Search code examples
discorddiscord.jsembed

Embed fields URL discord js


How to put url from field to config.json. But only the url, not the text. From this

.addField("**hi**", `[**Hello**](https:iegbshd)`)

to this

const { hello } = require('../config.json')

.addField("**hi**", `[**Hello**](hello)`)

config.json { "hello": "https:iegbshd" }


Solution

  • To use variables inside of `` quotes you need to put them into ${} and get such code:

    .addField("**hi**", `[**Hello**](${hello})`)