Cant get bot to work when put bot related files to another folder in src
Hello i try to put my botfiles to src/bot/ but the bot wont work if i do this:
Solution:Jump to solution
either drop the "bot" subfolder and set
main
to dist/index.js
in package.json
OR override the automatically resolved folder by setting baseUserDirectory
in the client options19 Replies
tsconfig.json
Sapphire will look for folders called
commands
and listeners
in the same directory that the main
property is configured to be at in the package.json
as per the top red block on our guide: https://sapphirejs.dev/docs/Guide/getting-started/getting-started-with-sapphire
You will have likely set it to dist/index.js
so you will either need dist/commands
and such, or set a custom directory with baseUserDirectory
in the client options. (make sure you dont set it to a directory in src
if you do!)Sapphire Framework
Getting started with Sapphire | Sapphire
To install Sapphire, you need to install both discord.js and
so i cant run the bot in src/bot ?
Node cannot run TS files directly so you will need to compile them first and as per your own config the files will be output to dist
yeah i can compile it but it doesnt recognized src/bot/listeners/
because of what I said...
Solution
either drop the "bot" subfolder and set
main
to dist/index.js
in package.json
OR override the automatically resolved folder by setting baseUserDirectory
in the client optionsbaseUserDirectory must be bot then?
dist/bot
is there more to the error
yes wait
other files also
I honestly have no idea. Pinging @kyra 🩵🩷🤍🩷🩵 in here
okay okay np
i set
baseUserDirectory: __dirname
it works now
maybe i missed some informations i moved the bot index.ts into src/bot folder
and created a index.ts
to src
root and imported ./bot/index.tsif you have
index.ts
in src/bot/
then you can just set main
to dist/bot/index.js
in your package.json
and drop the baseUserDirectory
yeah but i add some other applications to the bot
works now
thanks for your help
thank you just helped me unrelated but thought id let you know