How do I provide a variable for my interactionCreate event in another file?

archive "getdata.js"
async run({client, interaction, options}){
const filtered = choicesUsers.filter(({name}) => name.toLowerCase() === interaction.options.getString('identificator').toLowerCase())
let embed = new Discord.EmbedBuilder()
.setDescription(`ID: ${filtered[0].id} \n Usuário: ${filtered[0].name} \n Email: ${filtered[0].email} \n createdAt: ${filtered[0].createdAt} \n Discord | ID: ${filtered[0].discord ? filtered[0].discord.id : "Não Vinculado"} | username: ${filtered[0].discord ? filtered[0].discord.username : "Não vinculado"}`)
.setColor('Blurple')
async run({client, interaction, options}){
const filtered = choicesUsers.filter(({name}) => name.toLowerCase() === interaction.options.getString('identificator').toLowerCase())
let embed = new Discord.EmbedBuilder()
.setDescription(`ID: ${filtered[0].id} \n Usuário: ${filtered[0].name} \n Email: ${filtered[0].email} \n createdAt: ${filtered[0].createdAt} \n Discord | ID: ${filtered[0].discord ? filtered[0].discord.id : "Não Vinculado"} | username: ${filtered[0].discord ? filtered[0].discord.username : "Não vinculado"}`)
.setColor('Blurple')
I need to pass the 'filtered' variable to the file below to use it in the event archive "getDataInteraction.js"
const Discord = require("discord.js");
const { Events } = Discord;

module.exports = {
name: Events.InteractionCreate,
async execute(interaction) {
if (interaction.customId === 'account-licenses') {
console.log('license for: ??')
//interaction.edit()
}
},
};
const Discord = require("discord.js");
const { Events } = Discord;

module.exports = {
name: Events.InteractionCreate,
async execute(interaction) {
if (interaction.customId === 'account-licenses') {
console.log('license for: ??')
//interaction.edit()
}
},
};
3 Replies
d.js toolkit
d.js toolkit13mo 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!
d.js docs
d.js docs13mo ago
guide Popular Topics: Collectors - Interaction collectors > Basic message component collector read more
JoohnWiick
JoohnWiick13mo ago
I could not understand very well, I would stop using the event of the file "getDataInteraction.js" and start using this Collector?
Want results from more Discord servers?
Add your server