Problem with variable through multiple file

So i have 4 commands wich are like that:
const { SlashCommandBuilder } = require('discord.js');
const { cchannel } = require('./commands_channel');
const { wchannel } = require('./welcome_channel');
const { gechannel } = require('./general_channel');


module.exports = {
data: new SlashCommandBuilder()
.setName('goodbye_channel')
.setDescription('setup the goodbye channel'),
async execute(interaction) {
// interaction.guild is the object representing the Guild in which the command was run
const goodbye_channel = interaction.channel.id;
module.exports.gochannel = goodbye_channel
await interaction.reply({ content: Channel saved as Goodbye channel., ephemeral: true});

console.log(Command Channel: ${cchannel === undefined? 'Not set' : cchannel});
console.log(Goodbye Channel: ${goodbye_channel === undefined? 'Not set' : goodbye_channel});
console.log(Welcome Channel: ${wchannel === undefined? 'Not set' : wchannel});
console.log(General Channel: ${gechannel === undefined? 'Not set' : gechannel});

if(gechannel !== undefined && cchannel !== undefined && wchannel !== undefined){
module.exports.isConfig = true;
}

},
};
const { SlashCommandBuilder } = require('discord.js');
const { cchannel } = require('./commands_channel');
const { wchannel } = require('./welcome_channel');
const { gechannel } = require('./general_channel');


module.exports = {
data: new SlashCommandBuilder()
.setName('goodbye_channel')
.setDescription('setup the goodbye channel'),
async execute(interaction) {
// interaction.guild is the object representing the Guild in which the command was run
const goodbye_channel = interaction.channel.id;
module.exports.gochannel = goodbye_channel
await interaction.reply({ content: Channel saved as Goodbye channel., ephemeral: true});

console.log(Command Channel: ${cchannel === undefined? 'Not set' : cchannel});
console.log(Goodbye Channel: ${goodbye_channel === undefined? 'Not set' : goodbye_channel});
console.log(Welcome Channel: ${wchannel === undefined? 'Not set' : wchannel});
console.log(General Channel: ${gechannel === undefined? 'Not set' : gechannel});

if(gechannel !== undefined && cchannel !== undefined && wchannel !== undefined){
module.exports.isConfig = true;
}

},
};
(the same for the other channel like general_channel alias gechannel, command_channel alias cchannel and welcome_channel alias wechannel) but every time, the log only show the channel of the command (the channel logged locally, not through imports) plls help me
2 Replies
d.js toolkit
d.js toolkit2w ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Xalri
Xalri2w ago
(have something import, will be back in a long time)