1.3.5 • Published 1 year ago

@louiszn/discordjs-helper v1.3.5

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Discord.JS - Helper ✨

About

Discordjs-helper is an assistant that makes it easier for you to use discord.js.

  • Fast performance
  • Shorten your code
  • Easy to learn

Installation

Requirement: Discord.JS v14

$ npm install @louiszn/discordjs-helper
$ yarn add @louiszn/discordjs-helper
$ pnpm add @louiszn/discordjs-helper

Example Usage

Hybrid command

discord-bot/
├──commands
│  ├── ping.js
├──node_modules
├──index.js
├──package-lock.json
└──package.json

Start the handler

// index.js - CommonJS
const { Client } = require('discord.js');
const { LoadHybridCommand, Intents, Partials } = require('@louiszn/discordjs-helper');

const client = new Client({
  intents: [Intents.All],
  partials: [Partials.All],
});

LoadHybridCommand(client, {
  bot_prefix: '.', // ["prefix_1", "prefix_2"], function return string or string[]
  command_dir: 'commands',
  default_exports: true,
});

client.on('ready', async () => console.log(`${client.user.tag} is ready!`));

client.login('YOUR_BOT_TOKEN');
// index.js - ECMAScript modules
import { Client } from 'discord.js';
import { LoadHybridCommand, Intents, Partials } from '@louiszn/discordjs-helper';

const client = new Client({
  intents: [Intents.All],
  partials: [Partials.All],
});

LoadHybridCommand(client, {
  bot_prefix: '.', // ["prefix_1", "prefix_2"], function return string or string[]
  command_dir: 'commands',
  default_exports: true,
});

client.on('ready', async () => console.log(`${client.user.tag} is ready!`));

client.login('YOUR_BOT_TOKEN');

Example command

// ping.js - CommonJS
const { HybridCommand } = require('@louiszn/discordjs-helper');

module.exports = new HybridCommand({
  name: 'ping',
  description: 'Pong',
  run: async (client, ctx, args) => {
    ctx.send({ content: `Pong! ${client.ws.ping}ms!` });
  },
});
// ping.js ECMAScript modules
import { HybridCommand } from '@louiszn/discordjs-helper';

export default new HybridCommand({
  name: 'ping',
  description: 'Pong',
  run: async (client, ctx, args) => {
    ctx.send({ content: `Pong! ${client.ws.ping}ms!` });
  },
});

Preview

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.1.0

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago