Setting Up Your Project
Here is a basic example on how to setup your project with nocli-handler.js.
index.js
// Library Imports
const { Client, IntentsBitField, Partials, version } = require('discord.js');
const NoCliHandler = require('nocli-handler.js').default;
const path = require('path');
// Setting Up Client Object
const client = new Client({
// These intents are recommended for nocli-handler.js to handle commands
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.GuildMessageReactions,
IntentsBitField.Flags.DirectMessages,
IntentsBitField.Flags.MessageContent,
IntentsBitField.Flags.GuildMessageTyping
],
partials: [Partials.Channel, Partials.Message]
});
client.on("ready", () => {
const instance = new NoCliHandler({
client,
configuration: {
defaultPrefix: "", // Current: !
commandsDir: path.join(__dirname, 'commands'),
},
// clientVersion is required so that nocli-handler.js can help check
// if you are on the right version as the handler
language: "JavaScript"
});
});
index.ts
// Library Imports
import { Client, IntentsBitField, Partials, version } from 'discord.js';
import NoCliHandler from 'nocli-handler.js';
import path from 'path';
// Setting Up Client Object
const client = new Client({
// These intents are recommended for nocli-handler.js to handle commands
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.GuildMessageReactions,
IntentsBitField.Flags.DirectMessages,
IntentsBitField.Flags.MessageContent,
IntentsBitField.Flags.GuildMessageTyping
],
partials: [Partials.Channel, Partials.Message]
});
client.on("ready", () => {
const instance = new NoCliHandler({
client,
configuration: {
defaultPrefix: "", // Current: !
commandsDir: path.join(__dirname, 'commands'),
},
// clientVersion is required so that nocli-handler.js can help check
// if you are on the right version as the handler
clientVersion: version,
language: "JavaScript",
botOwners: ['your_discord_id']
});
});
Last updated