Installation

Warning

This page is still a work in progress.

There are 2 ways to install discm:

  • Use the cli.
  • Install and setup manually.

Using the Cli

Run the following command to use the cli.

npx create-discm@latest
shell
undefined

It will prompt a series of questions.

Tip

If you want to skip the questions and use the default settings use the -y flag.

npx create-discm@latest -y
shell
undefined

However, this will automatically use javascript to initialize the project.

The prompts help determine how you want your project to be scaffolded.

Once it has scaffolded the project for you, you can start coding right away!

Warning

The cli is still a work in progress, and some features may not work as intended.

Installing Manually

Run one of the following commands to install discm.js. Each command is package manager specific.

npm i discm.js
    
pnpm i discm.js
    
yarn add discm.js
    
bun add discm.js
    

Create Index File

In the root of your project, make a index.ts or index.js file.

This file should be listed as main in your package.json (if your using typescript it should be listed as dist/index.js), but it never hurts to double check.

Copy the following code and put it in your index file:

Note

The second parameter in client.login is not required if client.global is set to true.

// filename: index.ts
import { DiscmClient } from 'discm.js';
import { TOKEN, PRIVATE_SERVER_ID } from './config.json';

const client = new DiscmClient({
	intents: ['Guilds', 'GuildMessages', 'MessageContent'],
	dirs: {
		commands: `${__dirname}/commands`,
		events: `${__dirname}/events`
	},
	global: false,
	autoGenerateHelpCommand: true
});

client.login(TOKEN, PRIVATE_SERVER_ID);
// filename: index.js
const { DiscmClient } = require('discm.js');
const { TOKEN, PRIVATE_SERVER_ID } = require('./config.json');

const client = new DiscmClient({
	intents: ['Guilds', 'GuildMessages', 'MessageContent'],
	dirs: {
		commands: `${__dirname}/commands`,
		events: `${__dirname}/events`
	},
	global: false,
	autoGenerateHelpCommand: true
});

client.login(TOKEN, PRIVATE_SERVER_ID);