-
git clone https://github.com/oceanroleplay/discord.ts-example
-
cd discord.ts-example
-
npm install
-
npm run build
-
set BOT_TOKEN=<your bot token>
if you don't have token yet than create one at discord developer portal
-
npm run start
you are done, you will see your bot up and running. For detailed installation guide, please see this
This repository uses guild commands instead of global commands by default. This is because global command needs approximately 15 minutes to update itself every time.
comment this line in main.ts
use @Guild decorator on @Slash, check more information
This repo is targed to use ECMAScript modules by default. Follow these steps to use CommonJS.
{
// ...
"type": "commonjs",
// ...
"scripts": {
"build": "tsc",
"dev": "ts-node src/main.ts",
"start": "nodemon --exec ts-node src/main.ts",
"serve": "node build/main.js"
}
// ...
}
{
"compilerOptions": {
"target": "ESNext",
"module": "CommonJS"
// ...
}
}
async function run() {
// with cjs
await importx(__dirname + "/{events,commands}/**/*.{ts,js}");
// with ems
// await importx(dirname(import.meta.url) + "/{events,commands}/**/*.{ts,js}");
client.login(process.env.BOT_TOKEN ?? ""); // provide your bot token
}
Ask in discord server or open a issue
Show your support for discordx by giving us a star on github.