#slash command variable export

7 messages · Page 1 of 1 (latest)

warm smelt

You would need to export userMain as a property of module.export, like module.exports.userMain = userMain;

delicate herald
warm smelt
warm smelt

Like this

fileOne.js

module.exports = {
        // ...
    async execute(interaction) {
        const { guild } = interaction;
        module.exports.userMain = interaction.user.id;
        // ...
    },
    userMain: null
};

fileTwo.js

const { userMain } = require("./fileOne.js");
delicate herald

Ohh

It's work.T hank bro

delicate sonnet

That’s prone to race conditions so bad… you basically assume that only one person at a time will use that command