Skip to content

Latest commit

 

History

History
69 lines (57 loc) · 2.02 KB

File metadata and controls

69 lines (57 loc) · 2.02 KB

Discord.JS | Zach's Starter

About

This repository contains the starting code for my discord bots based on a tutorial I followed here. There are random comments sprinkled throught to help me recall the functionalities of sections
Please note that this is not the best starter code for making a discord bot with Discord.JS, but it's good enough for me at the moment.

Links

Setup

  1. Install relevant packages with npm install
  2. Setup .env with relevant info
TOKEN = 123
GUILD_ID = 123
CLIENT_ID = 123
  1. Setup config.json with relevant info
{
    "testServer": "123",
    "clientId": "123",
    "devs": [
        "123",
        "456"
    ]
}
  1. Run nodemon in the terminal in project root directory

Add Commands

Example commands are given in the starter code in /src/commands

Steps

  1. Go to the src/commands folder and add your command file into an appropriate nested folder OR make your own nested folder and put your command file into it
  2. Follow the same formatting as provided in the examples ping.js and ban.js
  3. run nodemon in the terminal
  4. Good Luck 😎

Example code for src/commands/misc/helloworld.js

module.exports = {
    name: 'helloworld',
    description: 'Classic Hello world',
    devOnly: false,

    callback: (client, interaction) => {
        interaction.reply({
          content: `Hello World! User: ${interaction.user.globalName}`,
          ephemeral: true,
        })
    },
};

Add Events

Handle different events. Example events are given in the starter code in /src/events