3.1.8-dev • Published 4 years ago

typescript-discord v3.1.8-dev

Weekly downloads
-
License
Apache-2.0 Licens...
Repository
github
Last release
4 years ago

Discord.js bot setup with typescript

I'm french but my english is bad, this readme contains only exemples to use Sucrose structure

This is a Typescript Discord bot structure

Documentation

Table of contents

commandsdescriptions
$ npm run buildbuild for production
$ npm startstart bot with ts-node in development
$ npm run start:prodbuild and start in production
$ npm start:respawndevelopment start with automatic restart

Getting started

steps
1Configure environment
2Create your first event
3Create yout first command

# Configure environment

Create .env file in base of project

NODE_ENV="development"
TOKEN="Your discord bot token"

NODE_ENV:

  • "development" to launch with typescript
  • "production" for configure to prod version

TOKEN:

Get your discord.js bot token in your discord application:

ATTENTION: Your token is secret, do not share it

# Create your first event

Create ready folder and this handler

- src
  - events
    - ready
      - handler.ts

Fill in the events/ready/handler.ts file

/* Typings */
import { Params } from 'src/structures/typings';

/* Listener */
export default async ({ sucrose }: Params<'ready'>) => {
  console.log('I love ferret');
};

# Create your first command

Create your command file in global (or a guild folder)

- src
  - commands
    - global
      - hi.ts

Fill in the commands/global/hi.ts file

/* Typings */
import { Command } from 'src/structures/typings';

export default <Command>{
  body: {
    name: 'hi',
    description: 'Say hi',
  },

  exec: ({ interaction }) => {
    interaction.reply('Hiiii !');
  },
};

Dependencies

3.1.8-dev

4 years ago

3.1.7-dev

4 years ago

3.1.6-dev

4 years ago

3.1.5-dev

4 years ago

3.1.4-dev

4 years ago

3.1.3-dev

4 years ago

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago