[WARNING] The command at C:\Users\.......\addalliance.js is missing a required "data" or "execute"..

index.js: https://sourceb.in/FGCNzQre9z addalliance.js: https://sourceb.in/adfWCh04hx deploy-commands.js: https://sourceb.in/xrmRL6CyDq when i use node deploy-commands.js in the terminal i get this warning and i have no clue why: [WARNING] The command at C:\Users........\addalliance.js is missing a required "data" or "execute" property. side note: when i remove the const { Alliances } = require('../../index.js'); line from addalliance.js the warning stops showing, but ive got no clue why.
15 Replies
d.js toolkit
d.js toolkitā€¢17mo 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!
safeeeee
safeeeeeOPā€¢17mo ago
issue described above ^
duck
duckā€¢17mo ago
side note: when i remove the const { Alliances } = require('../../index.js'); line from addalliance.js the warning stops showing, but ive got no clue why.
it sounds like you're possibly creating some circular import, causing addalliance.js to not export anything
safeeeee
safeeeeeOPā€¢17mo ago
yhh chatGPT was telling me that too, but i cant see where/why its happening
safeeeee
safeeeeeOPā€¢17mo ago
posted it in paste sites cuz it was too long jbp in the first message above
Zayd
Zaydā€¢17mo ago
oh I see
duck
duckā€¢17mo ago
well in index.js you import all of your commands in order to handle them then in your command, you import from index.js this is circular consider not creating and exporting your db schema from index.js, but rather somewhere else that both files can import from
safeeeee
safeeeeeOPā€¢17mo ago
consider not creating and exporting your db schema from index.js, but rather somewhere else that both files can import from
i tried this and still got circular dependency issues risihands try again and let you know what happens the thing is
Zayd
Zaydā€¢17mo ago
you shouldnt import your index.js at all, if possible it's a bad practice
safeeeee
safeeeeeOPā€¢17mo ago
in index.js i establish the connection info for the database, and i think thats where its supposed to stay right? so im gonna leave that there so what i need to do is move the model definition for Alliances into a separate file/folder instead of in index.js and then import it into addalliance.js? and to do that do i need to import anything from index.js into the new model definition file, such as the connection info? i think oh ok thanks for that sry if these questions sound dumb im tryna follow the official djs guide but it doesnt explain how to do all the importing properly it just put everything in index.js oh my days nevermind
duck
duckā€¢17mo ago
that'd be because you're expected to already understand that going into it the "Before you begin" section at the start of the guide suggests a decent grasp of javascript before making a bot
safeeeee
safeeeeeOPā€¢17mo ago
if i had just carried on looking at the rest of the tutorial they explained all of tht whatakaren
Zayd
Zaydā€¢17mo ago
LOL
safeeeee
safeeeeeOPā€¢17mo ago
nono it was just me being dumb i didnt read on and just stopped as soon as i got the error šŸ’€ uh thanks for your help everyone appreciate it
Want results from more Discord servers?
Add your server