0
module.exports = {
    bot: {
        version: "Pre-Alpha",
        displayType: "WATCHING",
        displayGame: `Looking for targets...           | Version: ${version}`
    },
    {
    ...
    }
}

Is there a way that i could use the variable "version" inside of displayGame?

2 Answers 2

1

Define the variable before assigning to exports so you can refer to it in both places.

let version = "Pre-Alpha";

module.exports = {
    bot: {
        version: version,
        displayType: "WATCHING",
        displayGame: `Looking for targets...           | Version: ${version}`
    },
    {
    ...
    }
}
Sign up to request clarification or add additional context in comments.

Comments

1

You can make it a function and pass the version to it. Then return the Object

module.exports = {
    bot(version) {
        return {
            version: version,
            displayType: 'WATCHING',
            displayGame: `Looking for targets...           | Version: ${version}`,
        };
    },
};

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.