This is a Discord bot using the sapphire framework written in TypeScript.
npm install
This example can be run with tsc-watch
to watch the files and automatically restart your bot.
npm run watch:start
You can also run the bot with npm dev
, this will first build your code and then run node ./dist/index.js
. But this is not the recommended way to run a bot in production.
-
Build Your TypeScript Code:
Compile your TypeScript code to JavaScript:
npx tsc
-
Run with PM2:
Use PM2 to run the compiled JavaScript file:
pm2 start dist/index.js --name typescript-bot
-
Save and Auto-Restart:
Save your PM2 process list and configure it to restart on system reboots:
pm2 save pm2 startup
Dedicated to the public domain via the Unlicense, courtesy of the Sapphire Community and its contributors.