Undefined when I try to pass objects to another file.

I am trying to figure out how to do embed pagination for my Discord bot and I getting stuck on this. gimme a min to explain everything.
3 Replies
Noxxe
Noxxe2y ago
I have a custom command handler, that splits the slash commands, select menus, buttons, etc. into different category, and what I am trying to do is, exports some variables and arrays using exports.<variable> = <variable> but nothing is working. Screenshot 1 is the command file. and for testing purposed I made so that when the next button is pressed it sends the values from the command file.
d.js docs
d.js docs2y ago
To share long code snippets use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks.
probablyraging
Not really djs related, but they are a few techniques to do it, in node, one would be.. fileOne.js
const myArr = ['objOne', 'objTwo', 'objThree']
const myVar = 'This is my var'

module.exports = {
myArr,
myVar
}
const myArr = ['objOne', 'objTwo', 'objThree']
const myVar = 'This is my var'

module.exports = {
myArr,
myVar
}
fileTwo.js
const { myArr, myVar } = require('./fileOne.js')

console.log(myArr, myVar)
const { myArr, myVar } = require('./fileOne.js')

console.log(myArr, myVar)