if you want to skipt the setup part scroll to the bottom to see available scripts a
if you don't already have yarn install it with:
npm install --global yarnnow install dependecies
yarn installcopy the example.env file and name it .env and put in your token and id
first create a copy of the !template.ts file located in src/commands/ and call it something of your chosing. Set the name and description, and fill in your code.
example: (do note the example code is already implemented)
...
export default {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with Pong!'),
async execute(interaction:ChatInputCommandInteraction) {
await interaction.reply('Pong!');
},
} as Commandadd your command to the commands.ts file located in src/
example:
import ping from "./commands/ping";
export const Commands: Command[] = [ping]the last step before actually running the bot, tell discord what commands we have
yarn run deployif you want to make guild specific commands you have to edit the deploy-commands.ts file located in src/
starting the bot can be done in two ways with or without nodemon
starts the bot with nodemon
yarn run watchstarts the bot normaly
yarn run startif you are getting erros you souldn't be getting try restarting the TS language server:
F1 → >Typescript: Restart TS server
starts the bot with nodemon
yarn run watchstarts the bot
yarn run start normallythis command updates the slashcommands on the discord side
yarn run deployif you have the eslint extention (vscode) you probably wont need this:
yarn run lint