Skip to content

TFAGaming/DiscordTS-Template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DiscordTS-Template

A very simple Discord bot made with TypeScript & discord.js version 14.

Installation

Install typescript globally:

npm i -g typescript

Install all the required dependencies:

npm i discord.js@14 dotenv

Rename the file .env.example to .env and fill all the required properties.

Warning If you are using repl.it, delete the .env file and use Secrets instead.

To compile the TypeScript files to JavaScript files & run the compiled files, use the command below:

npm run build

or, start the old compiled JavaScript files:

npm run build-start

Command example:

The class SlashCommandBuilder is from the library @discordjs/builders.

export default new Command({
    command_data: new SlashCommandBuilder()
        .toJSON(),
    options_data: {
        owner_only?: boolean
    },
    run: (client, interaction, args) => { }
});

How it works?

You can click here to understand how TypeScript compiler works.