[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
- 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!issue described above ^
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 anythingyhh chatGPT was telling me that too, but i cant see where/why its happening
posted it in paste sites cuz it was too long in the first message above
oh I see
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 fromconsider not creating and exporting your db schema from index.js, but rather somewhere else that both files can import fromi tried this and still got circular dependency issues try again and let you know what happens the thing is
you shouldnt import your index.js at all, if possible
it's a bad practice
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 nevermindthat'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
if i had just carried on looking at the rest of the tutorial they explained all of tht
LOL
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